Skip to content

Commit 8fe5406

Browse files
Version 1.3.2
1 parent d054c88 commit 8fe5406

12 files changed

+189
-39
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The Automatic Component Toolkit is an open source project.
33

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

6-
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.
6+
You can also contribute by reporting bugs in the [Issue tracker](../../issues), helping review pull requests, participate in discussions about issues and more.
77

88
## Filing issues
99
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
1919
## Submitting a pull request
2020
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.
2121

22-
__NOTE__ _Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). Please contact Martin Weismann [email protected] for a copy of the CLA._
22+
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.
23+
24+
__NOTE__ _Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). Please contact the maintainers via [email protected] for a copy of the CLA._
2325

2426

2527
## Maintainers

Examples/Primes/LibPrimes_component/Bindings/Pascal/Unit_LibPrimes.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ interface
7979

8080

8181
(*************************************************************************************************************************
82-
Declaration of function types
82+
Declaration of struct arrays
8383
**************************************************************************************************************************)
8484

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

8787
(*************************************************************************************************************************
88-
Declaration of struct arrays
88+
Declaration of function types
8989
**************************************************************************************************************************)
9090

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

9393
(*************************************************************************************************************************
9494
Declaration of handle classes

Examples/Primes/LibPrimes_component/Implementations/Pascal/Interfaces/libprimes_types.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ interface
7373

7474

7575
(*************************************************************************************************************************
76-
Declaration of function types
76+
Declaration of struct arrays
7777
**************************************************************************************************************************)
7878

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

8181
(*************************************************************************************************************************
82-
Declaration of struct arrays
82+
Declaration of function types
8383
**************************************************************************************************************************)
8484

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

8787
implementation
8888

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ calling the functions exported by your component via the thin C89-API.
2222
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.
2323

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

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

33-
Alternatively to 1) build act from source:
33+
Alternatively to 1) build ACT from source ([master](../../tree/master) for a released vesion, [develop](../../tree/develop) for the latest developments):
3434
1. Install go https://golang.org/doc/install
3535
2. Build automaticcomponenttoolkit.go:
3636
<br/>`Build\build.bat` on Windows or <br/>`Build\build.sh` on Unix

Source/automaticcomponenttoolkit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func readComponentDefinition(FileName string, ACTVersion string) (ComponentDefin
6969
}
7070

7171
func main () {
72-
ACTVersion := "1.3.1"
72+
ACTVersion := "1.3.2"
7373
fmt.Fprintln(os.Stdout, "Automatic Component Toolkit v" + ACTVersion)
7474
if (len (os.Args) < 2) {
7575
log.Fatal ("Please run with the Interface Description XML as command line parameter.");

Source/buildbindingcdynamic.go

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func buildDynamicCppImplementation(component ComponentDefinition, w LanguageWrit
324324
}
325325

326326

327-
func writeDynamicCPPMethodDefinition(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error {
327+
func writeDynamicCPPMethodDeclaration(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error {
328328
parameters := ""
329329
returntype := "void"
330330

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

382382

383383

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

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

576576
w.Writeln(" ")
577-
w.Writeln(" /**")
578-
w.Writeln(" * %s::%s - %s", cppClassName, method.MethodName, method.MethodDescription)
579-
w.Writelns(" ", commentcodeLines)
580-
w.Writeln(" */")
577+
if (includeComments) {
578+
w.Writeln(" /**")
579+
w.Writeln(" * %s::%s - %s", cppClassName, method.MethodName, method.MethodDescription)
580+
w.Writelns(" ", commentcodeLines)
581+
w.Writeln(" */")
582+
}
581583

582584
if (isGlobal) {
583585
w.Writeln(" inline %s %s::%s (%s)", returntype, cppClassName, method.MethodName, parameters)
584586
} else {
585-
w.Writeln(" %s %s (%s)", returntype, method.MethodName, parameters)
587+
w.Writeln(" %s %s::%s (%s)", returntype, cppClassName, method.MethodName, parameters)
586588
}
587589

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

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

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

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

902904
w.Writeln(" }")
905+
906+
w.Writeln(" ")
907+
908+
for i := 0; i < len(component.Classes); i++ {
909+
class := component.Classes[i]
910+
cppClassName := cppClassPrefix + class.ClassName
911+
w.Writeln(" ")
912+
w.Writeln(" /**")
913+
w.Writeln(" * Method definitions for class %s", cppClassName )
914+
w.Writeln(" */")
915+
for j := 0; j < len(class.Methods); j++ {
916+
method := class.Methods[j]
917+
err := writeDynamicCPPMethod(method, w, NameSpace, class.ClassName, false, false)
918+
if err != nil {
919+
return err
920+
}
921+
}
922+
}
923+
903924
w.Writeln("")
904925

905926
w.Writeln("} // namespace %s", NameSpace)

Source/buildbindinggo.go

Lines changed: 98 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"log"
4040
"os"
4141
"path"
42+
"errors"
4243
"strings"
4344
)
4445

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

510511

512+
513+
func getGoBasicType (paramType string) (string, error) {
514+
515+
switch (paramType) {
516+
case "uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64", "bool":
517+
return paramType, nil;
518+
519+
case "single":
520+
return "float32", nil;
521+
522+
case "double":
523+
return "float64", nil;
524+
525+
526+
}
527+
528+
return "", errors.New ("Invalid basic type: " + paramType);
529+
530+
}
531+
532+
511533
func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writer, NameSpace string, ClassName string, isGlobal bool, classdefinitions * string) (error) {
512534

513535
parameters := "";
@@ -541,11 +563,19 @@ func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writ
541563
errorreturn = errorreturn + fmt.Sprintf ("s%s, ", param.ParamName)
542564
case "handle":
543565
errorreturn = errorreturn + fmt.Sprintf ("h%s, ", param.ParamName)
566+
case "functiontype":
567+
errorreturn = errorreturn + fmt.Sprintf ("0, ")
568+
544569
case "basicarray":
545-
return fmt.Errorf("can not return basicarray \"%s\" for %s.%s (%s)", param.ParamPass, ClassName, method.MethodName, param.ParamName)
546-
570+
basicType, err := getGoBasicType (param.ParamClass);
571+
if (err != nil) {
572+
return err;
573+
}
574+
575+
errorreturn = errorreturn + fmt.Sprintf ("make ([]%s, 0), ", basicType);
576+
547577
case "structarray":
548-
return fmt.Errorf("can not return structarray \"%s\" for %s.%s (%s)", param.ParamPass, ClassName, method.MethodName, param.ParamName)
578+
errorreturn = errorreturn + fmt.Sprintf ("make ([]s%s%s, 0), ", NameSpace, param.ParamClass);
549579

550580
default:
551581
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
675705
callparameters = callparameters + "s" + param.ParamName;
676706

677707
case "basicarray":
678-
case "structarray":
708+
basicType, err := getGoBasicType (param.ParamClass);
709+
if (err != nil) {
710+
return err;
711+
}
712+
713+
comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
714+
parameters = parameters + fmt.Sprintf ("%s []%s", param.ParamName, basicType)
715+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0");
716+
callparameters = callparameters + param.ParamName;
679717

718+
719+
case "structarray":
720+
comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
721+
parameters = parameters + fmt.Sprintf ("%s []s%s%s", param.ParamName, NameSpace, param.ParamClass)
722+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0");
723+
callparameters = callparameters + param.ParamName;
724+
725+
case "functiontype":
726+
comments = comments + fmt.Sprintf(" * @param[in] p%s - %s\n", param.ParamName, param.ParamDescription);
727+
parameters = parameters + fmt.Sprintf ("p%s int64", param.ParamName)
728+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0");
729+
callparameters = callparameters + "p" + param.ParamName;
730+
680731
case "handle":
681732
comments = comments + fmt.Sprintf(" * @param[in] %s - %s\n", param.ParamName, param.ParamDescription);
682733
parameters = parameters + fmt.Sprintf ("%s %sHandle", param.ParamName, NameSpace)
@@ -849,15 +900,51 @@ func writeGoMethod (method ComponentDefinitionMethod, w io.Writer, implw io.Writ
849900
classreturnstring = classreturnstring + "e" + param.ParamName + ", ";
850901
classreturntypes = classreturntypes + fmt.Sprintf ("E%s%s, ", NameSpace, param.ParamClass);
851902

903+
904+
case "basicarray":
905+
basicType, err := getGoBasicType (param.ParamClass);
906+
if (err != nil) {
907+
return err;
908+
}
909+
910+
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
911+
returnvalues = returnvalues + fmt.Sprintf ("[]%s, ", basicType)
912+
impldeclarations = impldeclarations + fmt.Sprintf ("%sarray%s := make ([]%s, 0);\n", spacing, param.ParamName, basicType);
913+
implreturnvalues = implreturnvalues + fmt.Sprintf ("array%s, ", param.ParamName);
914+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0, 0");
915+
classreturnvariables = classreturnvariables + "array" + param.ParamName + ", ";
916+
classreturnstring = classreturnstring + "array" + param.ParamName + ", ";
917+
classreturntypes = classreturntypes + fmt.Sprintf ("[]%s, ", basicType);
918+
919+
case "structarray":
920+
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
921+
returnvalues = returnvalues + fmt.Sprintf ("[]s%s%s, ", NameSpace, param.ParamClass)
922+
impldeclarations = impldeclarations + fmt.Sprintf ("%sarray%s := make ([]s%s%s, 0);\n", spacing, param.ParamName, NameSpace, param.ParamClass);
923+
implreturnvalues = implreturnvalues + fmt.Sprintf ("array%s, ", param.ParamName);
924+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0, 0, 0");
925+
classreturnvariables = classreturnvariables + "array" + param.ParamName + ", ";
926+
classreturnstring = classreturnstring + "array" + param.ParamName + ", ";
927+
classreturntypes = classreturntypes + fmt.Sprintf ("[]s%s%s, ", NameSpace, param.ParamClass);
928+
929+
case "functiontype":
930+
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
931+
returnvalues = returnvalues + fmt.Sprintf ("uint64, ")
932+
impldeclarations = impldeclarations + fmt.Sprintf ("%svar p%s uint64 = 0;\n", spacing, param.ParamName);
933+
implreturnvalues = implreturnvalues + fmt.Sprintf ("p%s, ", param.ParamName);
934+
implcommandparameters = implcommandparameters + fmt.Sprintf (", UInt64OutValue (&p%s)", param.ParamName);
935+
classreturnvariables = classreturnvariables + "p" + param.ParamName + ", ";
936+
classreturnstring = classreturnstring + "p" + param.ParamName + ", ";
937+
classreturntypes = classreturntypes + fmt.Sprintf ("uint64, ");
938+
852939
case "struct":
853-
/*comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
940+
comments = comments + fmt.Sprintf (" * @return %s\n", param.ParamDescription);
854941
returnvalues = returnvalues + fmt.Sprintf ("s%s%s, ", NameSpace, param.ParamClass)
855-
impldeclarations = impldeclarations + fmt.Sprintf ("%svar s%s uint64 = 0;\n", spacing, param.ParamName);
856-
implreturnvalues = implreturnvalues + fmt.Sprintf ("E%s%s (e%s), ", NameSpace, param.ParamClass, param.ParamName);
857-
implcommandparameters = implcommandparameters + fmt.Sprintf (", UInt64OutValue (&e%s)", param.ParamName);
858-
classreturnvariables = classreturnvariables + "e" + param.ParamName + ", ";
859-
classreturnstring = classreturnstring + "e" + param.ParamName + ", ";
860-
classreturntypes = classreturntypes + fmt.Sprintf ("E%s%s, ", NameSpace, param.ParamClass);*/
942+
impldeclarations = impldeclarations + fmt.Sprintf ("%svar s%s s%s%s;\n", spacing, param.ParamName, NameSpace, param.ParamClass);
943+
implreturnvalues = implreturnvalues + fmt.Sprintf ("s%s, ", param.ParamName);
944+
implcommandparameters = implcommandparameters + fmt.Sprintf (", 0");
945+
classreturnvariables = classreturnvariables + "s" + param.ParamName + ", ";
946+
classreturnstring = classreturnstring + "s" + param.ParamName + ", ";
947+
classreturntypes = classreturntypes + fmt.Sprintf ("s%s%s, ", NameSpace, param.ParamClass);
861948

862949
case "handle":
863950
comments = comments + fmt.Sprintf(" * @return %s\n", param.ParamDescription);

Source/buildbindingnode.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ func writeNodeMethodImplementation(method ComponentDefinitionMethod, implw io.Wr
209209
callParameter = "s" + param.ParamName + ".c_str()"
210210
initCallParameter = callParameter;
211211

212+
case "basicarray":
213+
callParameter = "nullptr, 0";
214+
initCallParameter = callParameter;
215+
216+
case "structarray":
217+
callParameter = "nullptr, 0";
218+
initCallParameter = callParameter;
219+
220+
case "functiontype":
221+
callParameter = "nullptr";
222+
initCallParameter = callParameter;
223+
212224
case "bool":
213225
inputcheckfunction = "IsBoolean"
214226
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
234246
initCallParameter = callParameter;
235247

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

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

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

387+
case "basicarray":
388+
callParameter = "nullptr, 0, nullptr";
389+
initCallParameter = callParameter;
390+
391+
case "structarray":
392+
callParameter = "nullptr, 0, nullptr";
393+
initCallParameter = callParameter;
394+
395+
case "functiontype":
396+
callParameter = "nullptr";
397+
initCallParameter = callParameter;
398+
373399
case "handle":
374400
returndeclaration = returndeclaration + fmt.Sprintf("%s%sHandle hReturn%s = nullptr;\n", spacing, NameSpace, param.ParamName)
375401
callParameter = "&hReturn" + param.ParamName

0 commit comments

Comments
 (0)