Skip to content

Commit

Permalink
Version 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
martinweismann committed Dec 12, 2018
1 parent d054c88 commit 8fe5406
Showing 12 changed files with 189 additions and 39 deletions.
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ The Automatic Component Toolkit is an open source project.

Contributions are welcome and we are looking for people that can improve existing language bindings or create new bindings or implementation stubs.

You can also contribute by reporting bugs in the [Issue tracker](https://git.autodesk.com/netfabb/AutomaticComponentToolkit/issues), helping review pull requests, participate in discussions about issues and more.
You can also contribute by reporting bugs in the [Issue tracker](../../issues), helping review pull requests, participate in discussions about issues and more.

## Filing issues
1. When filing an issue to report errors or problems, make sure to answer these five questions:
@@ -19,7 +19,9 @@ You can also contribute by reporting bugs in the [Issue tracker](https://git.aut
## Submitting a pull request
When ready to contribute, fork this repository and submit a pull request that references the issue it resolves. Be sure to include a clear and detailed description of the changes you've made so that we can verify them and eventually merge.

__NOTE__ _Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). Please contact Martin Weismann martin.weismann@autodesk.com for a copy of the CLA._
ACT follows the [git-flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) branching model. New developments are integrated into the [develop](../../tree/develop)-branch. ACT's maintainers will create releases from the develop-branch when appropriate.

__NOTE__ _Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). Please contact the maintainers via automatic-component-toolkit.contributor.agreements@autodesk.com for a copy of the CLA._


## Maintainers
Original file line number Diff line number Diff line change
@@ -79,16 +79,16 @@ interface


(*************************************************************************************************************************
Declaration of function types
Declaration of struct arrays
**************************************************************************************************************************)

PLibPrimes_ProgressCallback = function(const fProgressPercentage: Single; out pShouldAbort: Cardinal): Integer;
ArrayOfLibPrimesPrimeFactor = array of TLibPrimesPrimeFactor;

(*************************************************************************************************************************
Declaration of struct arrays
Declaration of function types
**************************************************************************************************************************)

ArrayOfLibPrimesPrimeFactor = array of TLibPrimesPrimeFactor;
PLibPrimes_ProgressCallback = function(const fProgressPercentage: Single; out pShouldAbort: Cardinal): Integer;

(*************************************************************************************************************************
Declaration of handle classes
Original file line number Diff line number Diff line change
@@ -73,16 +73,16 @@ interface


(*************************************************************************************************************************
Declaration of function types
Declaration of struct arrays
**************************************************************************************************************************)

PLibPrimes_ProgressCallback = function(const fProgressPercentage: Single; out pShouldAbort: Cardinal): Integer;
ArrayOfLibPrimesPrimeFactor = array of TLibPrimesPrimeFactor;

(*************************************************************************************************************************
Declaration of struct arrays
Declaration of function types
**************************************************************************************************************************)

ArrayOfLibPrimesPrimeFactor = array of TLibPrimesPrimeFactor;
PLibPrimes_ProgressCallback = function(const fProgressPercentage: Single; out pShouldAbort: Cardinal): Integer;

implementation

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -22,15 +22,15 @@ calling the functions exported by your component via the thin C89-API.
A consumer of your component only needs to include the language binding relevant for them and not worry about the C89 interface or the underlying implementation.

## How to use ACT:
1) Download the precompiled binaries of from one of the [releases](https://github.com/Autodesk/AutomaticComponentToolkit/releases)
1) Download the precompiled binaries of from one of the [releases](../../releases)
2) Write an interface description file `idl_file.xml` for your desired component
3) Generate implementation stubs and language bindings for your component:
<br/>`act.exe idl_file.xml`
4) Integrate the generated code in your project

You are probably best of starting of with our extensive [Tutorial](Examples/Primes/Tutorial.md).

Alternatively to 1) build act from source:
Alternatively to 1) build ACT from source ([master](../../tree/master) for a released vesion, [develop](../../tree/develop) for the latest developments):
1. Install go https://golang.org/doc/install
2. Build automaticcomponenttoolkit.go:
<br/>`Build\build.bat` on Windows or <br/>`Build\build.sh` on Unix
2 changes: 1 addition & 1 deletion Source/automaticcomponenttoolkit.go
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ func readComponentDefinition(FileName string, ACTVersion string) (ComponentDefin
}

func main () {
ACTVersion := "1.3.1"
ACTVersion := "1.3.2"
fmt.Fprintln(os.Stdout, "Automatic Component Toolkit v" + ACTVersion)
if (len (os.Args) < 2) {
log.Fatal ("Please run with the Interface Description XML as command line parameter.");
41 changes: 31 additions & 10 deletions Source/buildbindingcdynamic.go
Original file line number Diff line number Diff line change
@@ -324,7 +324,7 @@ func buildDynamicCppImplementation(component ComponentDefinition, w LanguageWrit
}


func writeDynamicCPPMethodDefinition(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error {
func writeDynamicCPPMethodDeclaration(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error {
parameters := ""
returntype := "void"

@@ -381,7 +381,7 @@ func writeDynamicCPPMethodDefinition(method ComponentDefinitionMethod, w Languag



func writeDynamicCPPMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error {
func writeDynamicCPPMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool, includeComments bool) error {

CMethodName := ""
requiresInitCall := false;
@@ -574,15 +574,17 @@ func writeDynamicCPPMethod(method ComponentDefinitionMethod, w LanguageWriter, N
}

w.Writeln(" ")
w.Writeln(" /**")
w.Writeln(" * %s::%s - %s", cppClassName, method.MethodName, method.MethodDescription)
w.Writelns(" ", commentcodeLines)
w.Writeln(" */")
if (includeComments) {
w.Writeln(" /**")
w.Writeln(" * %s::%s - %s", cppClassName, method.MethodName, method.MethodDescription)
w.Writelns(" ", commentcodeLines)
w.Writeln(" */")
}

if (isGlobal) {
w.Writeln(" inline %s %s::%s (%s)", returntype, cppClassName, method.MethodName, parameters)
} else {
w.Writeln(" %s %s (%s)", returntype, method.MethodName, parameters)
w.Writeln(" %s %s::%s (%s)", returntype, cppClassName, method.MethodName, parameters)
}

w.Writeln(" {")
@@ -747,7 +749,7 @@ func buildDynamicCppHeader(component ComponentDefinition, w LanguageWriter, Name
for j := 0; j < len(global.Methods); j++ {
method := global.Methods[j]

err := writeDynamicCPPMethodDefinition(method, w, NameSpace, "Wrapper", true)
err := writeDynamicCPPMethodDeclaration(method, w, NameSpace, "Wrapper", true)
if err != nil {
return err
}
@@ -853,7 +855,7 @@ func buildDynamicCppHeader(component ComponentDefinition, w LanguageWriter, Name
for j := 0; j < len(class.Methods); j++ {
method := class.Methods[j]

err := writeDynamicCPPMethod(method, w, NameSpace, class.ClassName, false)
err := writeDynamicCPPMethodDeclaration(method, w, NameSpace, cppClassName, true)
if err != nil {
return err
}
@@ -865,7 +867,7 @@ func buildDynamicCppHeader(component ComponentDefinition, w LanguageWriter, Name
for j := 0; j < len(global.Methods); j++ {
method := global.Methods[j]

err := writeDynamicCPPMethod(method, w, NameSpace, "Wrapper", true)
err := writeDynamicCPPMethod(method, w, NameSpace, "Wrapper", true, true)
if err != nil {
return err
}
@@ -900,6 +902,25 @@ func buildDynamicCppHeader(component ComponentDefinition, w LanguageWriter, Name
w.AddIndentationLevel(-2)

w.Writeln(" }")

w.Writeln(" ")

for i := 0; i < len(component.Classes); i++ {
class := component.Classes[i]
cppClassName := cppClassPrefix + class.ClassName
w.Writeln(" ")
w.Writeln(" /**")
w.Writeln(" * Method definitions for class %s", cppClassName )
w.Writeln(" */")
for j := 0; j < len(class.Methods); j++ {
method := class.Methods[j]
err := writeDynamicCPPMethod(method, w, NameSpace, class.ClassName, false, false)
if err != nil {
return err
}
}
}

w.Writeln("")

w.Writeln("} // namespace %s", NameSpace)
109 changes: 98 additions & 11 deletions Source/buildbindinggo.go
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ import (
"log"
"os"
"path"
"errors"
"strings"
)

@@ -508,6 +509,27 @@ func buildGoWrapper (component ComponentDefinition, w io.Writer, implw io.Writer
}



func getGoBasicType (paramType string) (string, error) {

switch (paramType) {
case "uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64", "bool":
return paramType, nil;

case "single":
return "float32", nil;

case "double":
return "float64", nil;


}

return "", errors.New ("Invalid basic type: " + paramType);

}


func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writer, NameSpace string, ClassName string, isGlobal bool, classdefinitions * string) (error) {

parameters := "";
@@ -541,11 +563,19 @@ func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writ
errorreturn = errorreturn + fmt.Sprintf ("s%s, ", param.ParamName)
case "handle":
errorreturn = errorreturn + fmt.Sprintf ("h%s, ", param.ParamName)
case "functiontype":
errorreturn = errorreturn + fmt.Sprintf ("0, ")

case "basicarray":
return fmt.Errorf("can not return basicarray \"%s\" for %s.%s (%s)", param.ParamPass, ClassName, method.MethodName, param.ParamName)

basicType, err := getGoBasicType (param.ParamClass);
if (err != nil) {
return err;
}

errorreturn = errorreturn + fmt.Sprintf ("make ([]%s, 0), ", basicType);

case "structarray":
return fmt.Errorf("can not return structarray \"%s\" for %s.%s (%s)", param.ParamPass, ClassName, method.MethodName, param.ParamName)
errorreturn = errorreturn + fmt.Sprintf ("make ([]s%s%s, 0), ", NameSpace, param.ParamClass);

default:
return fmt.Errorf ("invalid method parameter type \"%s\" for %s.%s (%s)", param.ParamType, ClassName, method.MethodName, param.ParamName);
@@ -675,8 +705,29 @@ func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writ
callparameters = callparameters + "s" + param.ParamName;

case "basicarray":
case "structarray":
basicType, err := getGoBasicType (param.ParamClass);
if (err != nil) {
return err;
}

comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
parameters = parameters + fmt.Sprintf ("%s []%s", param.ParamName, basicType)
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0");
callparameters = callparameters + param.ParamName;


case "structarray":
comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
parameters = parameters + fmt.Sprintf ("%s []s%s%s", param.ParamName, NameSpace, param.ParamClass)
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0");
callparameters = callparameters + param.ParamName;

case "functiontype":
comments = comments + fmt.Sprintf(" * @param[in] p%s - %s\n", param.ParamName, param.ParamDescription);
parameters = parameters + fmt.Sprintf ("p%s int64", param.ParamName)
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0");
callparameters = callparameters + "p" + param.ParamName;

case "handle":
comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
parameters = parameters + fmt.Sprintf ("%s %sHandle", param.ParamName, NameSpace)
@@ -849,15 +900,51 @@ func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writ
classreturnstring = classreturnstring + "e" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("E%s%s, ", NameSpace, param.ParamClass);


case "basicarray":
basicType, err := getGoBasicType (param.ParamClass);
if (err != nil) {
return err;
}

comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
returnvalues = returnvalues + fmt.Sprintf ("[]%s, ", basicType)
impldeclarations = impldeclarations + fmt.Sprintf ("%sarray%s := make ([]%s, 0);\n", spacing, param.ParamName, basicType);
implreturnvalues = implreturnvalues + fmt.Sprintf ("array%s, ", param.ParamName);
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0, 0");
classreturnvariables = classreturnvariables + "array" + param.ParamName + ", ";
classreturnstring = classreturnstring + "array" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("[]%s, ", basicType);

case "structarray":
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
returnvalues = returnvalues + fmt.Sprintf ("[]s%s%s, ", NameSpace, param.ParamClass)
impldeclarations = impldeclarations + fmt.Sprintf ("%sarray%s := make ([]s%s%s, 0);\n", spacing, param.ParamName, NameSpace, param.ParamClass);
implreturnvalues = implreturnvalues + fmt.Sprintf ("array%s, ", param.ParamName);
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0, 0");
classreturnvariables = classreturnvariables + "array" + param.ParamName + ", ";
classreturnstring = classreturnstring + "array" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("[]s%s%s, ", NameSpace, param.ParamClass);

case "functiontype":
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
returnvalues = returnvalues + fmt.Sprintf ("uint64, ")
impldeclarations = impldeclarations + fmt.Sprintf ("%svar p%s uint64 = 0;\n", spacing, param.ParamName);
implreturnvalues = implreturnvalues + fmt.Sprintf ("p%s, ", param.ParamName);
implcommandparameters = implcommandparameters + fmt.Sprintf (", UInt64OutValue (&p%s)", param.ParamName);
classreturnvariables = classreturnvariables + "p" + param.ParamName + ", ";
classreturnstring = classreturnstring + "p" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("uint64, ");

case "struct":
/*comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
returnvalues = returnvalues + fmt.Sprintf ("s%s%s, ", NameSpace, param.ParamClass)
impldeclarations = impldeclarations + fmt.Sprintf ("%svar s%s uint64 = 0;\n", spacing, param.ParamName);
implreturnvalues = implreturnvalues + fmt.Sprintf ("E%s%s (e%s), ", NameSpace, param.ParamClass, param.ParamName);
implcommandparameters = implcommandparameters + fmt.Sprintf (", UInt64OutValue (&e%s)", param.ParamName);
classreturnvariables = classreturnvariables + "e" + param.ParamName + ", ";
classreturnstring = classreturnstring + "e" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("E%s%s, ", NameSpace, param.ParamClass);*/
impldeclarations = impldeclarations + fmt.Sprintf ("%svar s%s s%s%s;\n", spacing, param.ParamName, NameSpace, param.ParamClass);
implreturnvalues = implreturnvalues + fmt.Sprintf ("s%s, ", param.ParamName);
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0");
classreturnvariables = classreturnvariables + "s" + param.ParamName + ", ";
classreturnstring = classreturnstring + "s" + param.ParamName + ", ";
classreturntypes = classreturntypes + fmt.Sprintf ("s%s%s, ", NameSpace, param.ParamClass);

case "handle":
comments = comments + fmt.Sprintf(" * @return %s\n", param.ParamDescription);
30 changes: 28 additions & 2 deletions Source/buildbindingnode.go
Original file line number Diff line number Diff line change
@@ -209,6 +209,18 @@ func writeNodeMethodImplementation(method ComponentDefinitionMethod, implw io.Wr
callParameter = "s" + param.ParamName + ".c_str()"
initCallParameter = callParameter;

case "basicarray":
callParameter = "nullptr, 0";
initCallParameter = callParameter;

case "structarray":
callParameter = "nullptr, 0";
initCallParameter = callParameter;

case "functiontype":
callParameter = "nullptr";
initCallParameter = callParameter;

case "bool":
inputcheckfunction = "IsBoolean"
inputdeclaration = inputdeclaration + fmt.Sprintf("%sbool b%s = args[%d]->BooleanValue ();\n", spacing, param.ParamName, k)
@@ -234,7 +246,9 @@ func writeNodeMethodImplementation(method ComponentDefinitionMethod, implw io.Wr
initCallParameter = callParameter;

case "struct":
return fmt.Errorf("parameter type \"%s\" not yet supported for %s.%s (%s)", param.ParamType, ClassName, method.MethodName, param.ParamName)
callParameter = "nullptr";
initCallParameter = callParameter;
//return fmt.Errorf("parameter type \"%s\" not yet supported for %s.%s (%s)", param.ParamType, ClassName, method.MethodName, param.ParamName)

case "handle":
inputcheckfunction = "IsObject"
@@ -368,8 +382,20 @@ func writeNodeMethodImplementation(method ComponentDefinitionMethod, implw io.Wr
callParameter = "&sReturn" + param.ParamName
initCallParameter = callParameter;

return fmt.Errorf("can not return struct \"%s\" for %s.%s (%s) yet in nodejs", param.ParamType, ClassName, method.MethodName, param.ParamName)
//return fmt.Errorf("can not return struct \"%s\" for %s.%s (%s) yet in nodejs", param.ParamType, ClassName, method.MethodName, param.ParamName)

case "basicarray":
callParameter = "nullptr, 0, nullptr";
initCallParameter = callParameter;

case "structarray":
callParameter = "nullptr, 0, nullptr";
initCallParameter = callParameter;

case "functiontype":
callParameter = "nullptr";
initCallParameter = callParameter;

case "handle":
returndeclaration = returndeclaration + fmt.Sprintf("%s%sHandle hReturn%s = nullptr;\n", spacing, NameSpace, param.ParamName)
callParameter = "&hReturn" + param.ParamName
Loading

0 comments on commit 8fe5406

Please sign in to comment.