diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1716ee8..c68894bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/Examples/Primes/LibPrimes_component/Bindings/Pascal/Unit_LibPrimes.pas b/Examples/Primes/LibPrimes_component/Bindings/Pascal/Unit_LibPrimes.pas index 3c8c0ee8..84befe46 100644 --- a/Examples/Primes/LibPrimes_component/Bindings/Pascal/Unit_LibPrimes.pas +++ b/Examples/Primes/LibPrimes_component/Bindings/Pascal/Unit_LibPrimes.pas @@ -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 diff --git a/Examples/Primes/LibPrimes_component/Implementations/Pascal/Interfaces/libprimes_types.pas b/Examples/Primes/LibPrimes_component/Implementations/Pascal/Interfaces/libprimes_types.pas index 38ddc5e3..0f6d4f16 100644 --- a/Examples/Primes/LibPrimes_component/Implementations/Pascal/Interfaces/libprimes_types.pas +++ b/Examples/Primes/LibPrimes_component/Implementations/Pascal/Interfaces/libprimes_types.pas @@ -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 diff --git a/README.md b/README.md index 421aeae2..95f0e494 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ 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:
`act.exe idl_file.xml` @@ -30,7 +30,7 @@ A consumer of your component only needs to include the language binding relevant 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:
`Build\build.bat` on Windows or
`Build\build.sh` on Unix diff --git a/Source/automaticcomponenttoolkit.go b/Source/automaticcomponenttoolkit.go index 0c0c6454..3ad4ccfb 100644 --- a/Source/automaticcomponenttoolkit.go +++ b/Source/automaticcomponenttoolkit.go @@ -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."); diff --git a/Source/buildbindingcdynamic.go b/Source/buildbindingcdynamic.go index 2f161842..cf313555 100644 --- a/Source/buildbindingcdynamic.go +++ b/Source/buildbindingcdynamic.go @@ -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) diff --git a/Source/buildbindinggo.go b/Source/buildbindinggo.go index 2d0d0702..861ecafd 100644 --- a/Source/buildbindinggo.go +++ b/Source/buildbindinggo.go @@ -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); diff --git a/Source/buildbindingnode.go b/Source/buildbindingnode.go index 4f303553..0b3bcfa6 100644 --- a/Source/buildbindingnode.go +++ b/Source/buildbindingnode.go @@ -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 diff --git a/Source/buildbindingpython.go b/Source/buildbindingpython.go index d044c3a7..bada1ad6 100644 --- a/Source/buildbindingpython.go +++ b/Source/buildbindingpython.go @@ -626,6 +626,9 @@ func writeMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace s } switch param.ParamType { case "handle": { + if (retVals != "") { + retVals = retVals + ", "; + } preCallLines = append(preCallLines, fmt.Sprintf("%sHandle = %s()", param.ParamName, cParams[0].ParamCallType)) newArgument := fmt.Sprintf("%sHandle", param.ParamName) cArguments = cArguments + newArgument @@ -636,6 +639,9 @@ func writeMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace s retVals = retVals + fmt.Sprintf("%sObject", param.ParamName) } case "string": { + if (retVals != "") { + retVals = retVals + ", "; + } preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[0].ParamName, cParams[0].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[1].ParamName, cParams[1].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(None)", cParams[2].ParamName, cParams[2].ParamCallType)) @@ -648,6 +654,9 @@ func writeMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace s retVals = retVals + cParams[2].ParamName + ".value.decode()" } case "basicarray": { + if (retVals != "") { + retVals = retVals + ", "; + } preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[0].ParamName, cParams[0].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[1].ParamName, cParams[1].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = (%s*0)()", cParams[2].ParamName, cParams[2].ParamCallType)) @@ -661,6 +670,9 @@ func writeMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace s retVals = retVals + fmt.Sprintf("[%s[i] for i in range(%s.value)]", cParams[2].ParamName, cParams[1].ParamName) } case "structarray": { + if (retVals != "") { + retVals = retVals + ", "; + } preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[0].ParamName, cParams[0].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = %s(0)", cParams[1].ParamName, cParams[1].ParamCallType)) preCallLines = append(preCallLines, fmt.Sprintf("%s = (%s*0)()", cParams[2].ParamName, cParams[2].ParamCallType)) diff --git a/Source/buildimplementationcpp.go b/Source/buildimplementationcpp.go index 4cc17e72..ff02f884 100644 --- a/Source/buildimplementationcpp.go +++ b/Source/buildimplementationcpp.go @@ -514,7 +514,7 @@ func writeCImplementationMethod(method ComponentDefinitionMethod, w LanguageWrit preCallCPPFunctionCode } - w.Writeln("%s_DECLSPEC %sResult %s (%s)", strings.ToUpper(BaseName), NameSpace, CMethodName, cparameters) + w.Writeln("%sResult %s (%s)", NameSpace, CMethodName, cparameters) w.Writeln("{") if (doJournal) { diff --git a/Source/languagec.go b/Source/languagec.go index c92890b2..536decd1 100644 --- a/Source/languagec.go +++ b/Source/languagec.go @@ -454,7 +454,7 @@ func WriteCMethod (method ComponentDefinitionMethod, w LanguageWriter, NameSpace if (writeCallbacks) { w.Writeln("typedef %sResult (*%s) (%s);", NameSpace, CCallbackName, parameters); } else { - w.Writeln("%s_DECLSPEC %sResult %s (%s);", strings.ToUpper(NameSpace), NameSpace, CMethodName, parameters); + w.Writeln("%s_DECLSPEC %sResult %s(%s);", strings.ToUpper(NameSpace), NameSpace, CMethodName, parameters); } return nil; diff --git a/Source/languagepascal.go b/Source/languagepascal.go index c3b4eef4..933d791a 100644 --- a/Source/languagepascal.go +++ b/Source/languagepascal.go @@ -186,6 +186,8 @@ func writePascalBaseTypeDefinitions(componentdefinition ComponentDefinition, w L w.Writeln (" Declaration of function types"); w.Writeln ("**************************************************************************************************************************)"); w.Writeln (""); + w.Writeln ("type"); + w.Writeln (""); for i := 0; i < len(componentdefinition.Functions); i++ { funcinfo := componentdefinition.Functions[i]; arguments := "" @@ -201,7 +203,7 @@ func writePascalBaseTypeDefinitions(componentdefinition ComponentDefinition, w L arguments = arguments + cParams[0].ParamConvention + cParams[0].ParamName + ": " + cParams[0].ParamType } - w.Writeln (" P%s_%s = function(%s): Integer;", NameSpace, funcinfo.FunctionName, arguments); + w.Writeln (" P%s_%s = function(%s): Integer; cdecl;", NameSpace, funcinfo.FunctionName, arguments); } }