Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
3e2b56b
Add RTTI example basis
fsahmad Dec 7, 2020
59cef79
Implement stubs
fsahmad Dec 7, 2020
be3950b
Add ImplementsInterface to implementation
fsahmad Dec 8, 2020
1524a7f
Add casts to bindings and examples
fsahmad Dec 8, 2020
c21150b
Change Cpp binding static member var to function
fsahmad Dec 8, 2020
6a5743f
Autogenerate skeleton for ImplementsInterfaceMethod
martinweismann Dec 15, 2020
c0224d3
Update RTTI example with changes
fsahmad Jan 4, 2021
7ba28d4
Generate implementsinterface method
fsahmad Jan 4, 2021
9589592
RTTI methods in CppDynamic binding
fsahmad Jan 4, 2021
3d85067
Delete pycache file from example
fsahmad Jan 4, 2021
ef7e591
Python RTTI
fsahmad Jan 5, 2021
1731ad4
Fix hardcoded namespace RTTI
fsahmad Jan 18, 2021
a256dd7
Inline binding getClassName method
fsahmad Jan 18, 2021
d462710
Update RTTI example
fsahmad Jan 28, 2021
2339361
Update RTTI generated code (inline getClassName)
fsahmad Jan 28, 2021
e7042a5
Fix CPP binding to inc ref count
fsahmad Jan 28, 2021
883d6e0
Fix Python binding to inc ref count
fsahmad Jan 28, 2021
a40ca23
Update RTTI examples to print name
fsahmad Jan 28, 2021
40fb5f3
Add missing Name method to RTTI.xml
fsahmad Feb 23, 2021
64d1a73
Merge branch 'develop' into rtti
martinweismann Mar 12, 2021
c302c9e
Fix names of special classes and methods in generation code
martinweismann Apr 7, 2021
a55da70
Hash class ids in C++ bindings
fsahmad Apr 8, 2021
67088cb
Use hash to id class in C++ implementation
fsahmad Apr 8, 2021
d378681
Hash class ids in Python bindings
fsahmad Apr 12, 2021
84a92c7
Merge branch 'develop' into rtti
alexanderoster Aug 10, 2021
745f92b
Merge branch 'develop' into rtti
alexanderoster Aug 10, 2021
d36b490
Merge remote-tracking branch 'origin/develop' into rtti
anpilog Oct 4, 2021
8b6129f
#148 Hack to fix compilation failure
fsahmad Feb 23, 2021
15e2fcb
Fix initialisation order warning
woodwan Apr 19, 2021
a34cb4a
Use correct namespace
anpilog Oct 6, 2021
470a690
Revert "#148 Hack to fix compilation failure"
anpilog Oct 6, 2021
554c6d3
Fix string cache comp. error (#148)
martinweismann Oct 6, 2021
3292f4d
Export GO environment variables properly
anpilog Oct 6, 2021
aeba8e4
Update RTTI example
anpilog Oct 7, 2021
e674359
Fix compilation error
anpilog Oct 18, 2021
3cd19ac
Add ClassTypeId an PolymorphicFactory
anpilog Oct 18, 2021
db0262c
Update Python and C++ examples
anpilog Oct 18, 2021
f9dc1a2
Remove duplicated definition of ClassTypeId method in base class
anpilog Oct 18, 2021
ad161bb
Update C++ example
anpilog Oct 18, 2021
33252bd
Add Pascal implementation and exmaple
anpilog Oct 18, 2021
8b874bd
Tune Pascal project
anpilog Oct 19, 2021
8536468
Merge remote-tracking branch 'origin/develop' into rtti-native
anpilog Oct 19, 2021
fde00e8
Fix year
anpilog Oct 19, 2021
af2f664
Update year
anpilog Oct 19, 2021
6a5a8c0
Cast hex numbers to QWord and fix a warning
anpilog Oct 20, 2021
aef8400
Update date
anpilog Oct 22, 2021
2ae1e8c
Add CDynamic
anpilog Oct 22, 2021
ac46ae7
Add Cpp example
anpilog Oct 22, 2021
5fafb2c
Add Go bindings support and example
anpilog Oct 22, 2021
c899151
Add C# bindings support and example
anpilog Oct 22, 2021
7c9ca06
Add Java bindings support and example
anpilog Oct 22, 2021
03f82ce
Missed changes in IDL file
anpilog Oct 22, 2021
d08c435
Better filtet for build files
anpilog Oct 26, 2021
5658208
Common build bash script
anpilog Oct 26, 2021
7896c85
Add Docker image and helper scripts
anpilog Oct 26, 2021
6e7fbcb
Add build scripts
anpilog Oct 26, 2021
43f0a56
Update exmaple IDL files with ClassTypeId definition
anpilog Oct 26, 2021
f09f06f
cgo on Linux required linking with dl library
anpilog Oct 26, 2021
1217b84
Don't overwrite build scripts
anpilog Oct 26, 2021
97c43eb
Don't overwrite build scripts
anpilog Oct 26, 2021
230d18f
Force Jave use UTF8 encoding and enable asserts
anpilog Oct 26, 2021
7b260df
Go: fix compilation error due to wrong type convertion
anpilog Oct 26, 2021
a58483f
Use correct handle type for injected components
anpilog Oct 26, 2021
f9ae6b3
Don't remove rtti_dynamic.cc and keep git happy
anpilog Oct 26, 2021
0ae3b8a
Use printf and correct library name
anpilog Oct 26, 2021
f1cefb7
Fix wrong file name
anpilog Oct 26, 2021
7dabdce
RTTI Cpp and CppDynamic with validation
anpilog Oct 26, 2021
c3c7a85
RTTI Python example with validation
anpilog Oct 26, 2021
aa0c90d
RTTI Go: get library path from command line
anpilog Oct 26, 2021
0c7d091
Tune path so it could be defined by env
anpilog Oct 26, 2021
9123b77
RTTI Java eexample with validation
anpilog Oct 26, 2021
35bba35
RTTI C# with validation
anpilog Oct 26, 2021
56aa2f9
Ignore C# specific subfolders
anpilog Oct 26, 2021
39c1a2d
Use OS independent path to libraries
anpilog Oct 26, 2021
c7ca136
Update Injection exmaple implementation
anpilog Oct 26, 2021
9f80a6a
Fix MacOS vuild script
anpilog Oct 26, 2021
c54dffc
PolymorphicFactory should return object of default class
anpilog Oct 26, 2021
e75868e
Sort classes to have consistent changes in bindings
anpilog Oct 26, 2021
d48c698
Add a warning comment to PolymorphicFactory method
anpilog Oct 26, 2021
e55dffd
Revert Go binding generator
anpilog Oct 26, 2021
b766ae3
cgo on Linux required linking with dl library
anpilog Oct 26, 2021
dca72ea
Fix condition for not null object
anpilog Oct 26, 2021
9f79122
Go: fix compilation error due to wrong type convertion
anpilog Oct 26, 2021
edd2319
Explicitely return empty object for empty handle
anpilog Oct 27, 2021
ae31bbc
CSharp: revert typed handle
anpilog Oct 27, 2021
597ccfa
Java: revert typed handle
anpilog Oct 27, 2021
f645fef
Use curl instead of wget
anpilog Oct 27, 2021
92d2de7
Implement missed case for statically linked lib
anpilog Oct 27, 2021
e5daba7
Fix build scripts
anpilog Oct 27, 2021
44ee463
Fix RTTI Examples
anpilog Oct 27, 2021
6d49be6
Update RTTI bindings
anpilog Oct 27, 2021
d225dcc
Ignore empty examples
anpilog Oct 27, 2021
05f0304
Ignore empty examples
anpilog Oct 27, 2021
9cef0c5
Update Injection example
anpilog Oct 27, 2021
8c416eb
Add ClassTypeId descriptpion to documentation
anpilog Oct 27, 2021
19b02a7
Fix style
anpilog Oct 27, 2021
121f8bd
Return ClassTypeId explicitely
anpilog Oct 27, 2021
45c5d11
Update docker.sh helper script
anpilog Oct 27, 2021
f29ab23
Update documentation
anpilog Oct 27, 2021
dc1a68f
Better support for FPC 3.0.4
anpilog Oct 27, 2021
f186d05
Save stub code for FPC 3.0.4
anpilog Oct 27, 2021
f258f7c
Return ClassTypeId without intermediate variables
anpilog Oct 27, 2021
81ea4d2
Specialized PolymorphicFactories for FPC 3.0.4
anpilog Oct 27, 2021
80e36d0
Update bindings for FPC 3.0.4
anpilog Oct 27, 2021
5956f25
Switch to FPC 3.0.4 in Docker
anpilog Oct 27, 2021
ffe8e41
Fix hardcodded namespace
anpilog Oct 27, 2021
81c1db4
Mono requires netstandard2.0
anpilog Oct 27, 2021
9bdf080
Add CSharp example
anpilog Oct 27, 2021
8798e92
Suppress examples
anpilog Oct 27, 2021
1372903
Fix mistype
anpilog Oct 27, 2021
5b535af
Fix hardcoded namespace
anpilog Oct 28, 2021
ee9ca3c
Add Java example
anpilog Oct 28, 2021
29a236b
Use full class type for injected components
anpilog Oct 28, 2021
3a4594a
Use correct header
anpilog Oct 28, 2021
75b51bd
Remove CSharp example
anpilog Oct 28, 2021
ec0c123
Remove CSharp example
anpilog Oct 28, 2021
24c09f1
Restore Java bindings generation
anpilog Oct 28, 2021
aa11c6d
Add more covarage with object as a argument
anpilog Nov 5, 2021
61c7194
Fix warnings
anpilog Nov 5, 2021
fb63dc1
Don't use templates for PolymorficFactory
anpilog Nov 5, 2021
f080013
Update examples with recent changes
anpilog Nov 5, 2021
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
24 changes: 15 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
*.cpp
*.hpp
*.h
*.exe
*.linux
*.darwin
*.exe
*.dylib
*.so
*.dll
*.arm
*.c
*.go
*.orig
*.class
*.jar
*.log
*.o
*.ppu
__pycache__

Examples/**/build
Examples/**/build-*
Examples/**/bin
Examples/**/obj

# Visual Studio Code
debug
.vscode

*_headers
*_component

Examples/*.xml
.DS_Store
84 changes: 84 additions & 0 deletions Build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM centos:centos8

LABEL maintainer="Andrii Anpilogov (andrii.anpilogov@autodesk.com)"

ARG USER_ID
ARG GROUP_ID

RUN : "${USER_ID:?Build argument needs to be set and non-empty.}" \
: "${GROUP_ID:?Build argument needs to be set and non-empty.}"

RUN [ -e /etc/yum.conf ] && sed -i '/tsflags=nodocs/d' /etc/yum.conf || true

# RUN yum install -y icu

RUN dnf -y install dnf-plugins-core
RUN dnf -y install dnf-plugin-config-manager
RUN dnf -y update

RUN dnf -y install epel-release
RUN dnf -y config-manager --set-enabled powertools

# GCC
RUN dnf -y install gcc-toolset-9-gcc
RUN dnf -y install gcc-toolset-9-gcc-c++

# CMake & Ninja
RUN dnf -y install cmake
RUN dnf -y install ninja-build

# Free Pascal
# 3.0.4 should be used for validating compiler base compatibility.
RUN (cd /opt && curl -O -L 'http://downloads.sourceforge.net/project/freepascal/Linux/3.0.4/fpc-3.0.4-1.x86_64.rpm' \
&& rpm -i fpc-3.0.4-1.x86_64.rpm)
# Using 3.2.2 until PolymorphicFactory is reworked to not using generics that are not full functional in 3.0.4.
# RUN (cd /opt && curl -O -L 'http://downloads.sourceforge.net/project/freepascal/Linux/3.2.2/fpc-3.2.2-1.x86_64.rpm' \
# && rpm -i fpc-3.2.2-1.x86_64.rpm)

# Golang
RUN (cd /opt && curl -O -L https://golang.org/dl/go1.17.2.linux-amd64.tar.gz \
&& tar zxvf go1.17.2.linux-amd64.tar.gz)

# Java
RUN dnf -y install \
java-11-openjdk-devel

# Mono
RUN rpm --import https://download.mono-project.com/repo/xamarin.gpg \
&& dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo \
&& dnf -y install mono-complete


# General purpose tools
RUN dnf -y install \
glibc-common \
glibc-utils \
less \
passwd \
tar \
vim-minimal \
vim-enhanced \
which \
sudo \
bash-completion \
mc \
yum-utils \
&& yum clean all

# Create user
RUN groupadd docker \
&& useradd -ms /bin/bash --uid $USER_ID -g docker -G wheel user \
&& printf "user:user" | chpasswd \
&& printf "user ALL= NOPASSWD: ALL\\n" >> /etc/sudoers

# Initialize Toolkit
RUN echo "source /opt/rh/gcc-toolset-9/enable" >> /home/user/.bash_profile
RUN echo "export PATH=\$PATH:/opt/go/bin" >> /home/user/.bash_profile

VOLUME /data

# Run Container as nonroot
USER user
WORKDIR /data

ENTRYPOINT [ "/bin/bash", "-l" ]
42 changes: 41 additions & 1 deletion Build/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,44 @@ https://github.com/pavel-a/ddverpatch/releases
Call like this
```
verpatch.exe ..\act.exe /high /va 1.5.0 /pv "1.5.0-RC1+buildnumber-5" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
```
```

## Docker

Docker image can be used to build ACT and all its example.

**Build Docker image:**
```
./Build/build.sh
```

**Build ACT and all examples**
```
# go into root folder of this repo
docker run -it --rm -v $PWD:/data act-build
```

**Run Docker image interactively:**
```
# go into root folder of this repo
docker run -it --rm -v $PWD:/data --entrypoint bash act-build -l
```
Source code is available in `/data` directory.

**Useful scripts**
| Script | Description|
|--------|------------|
| `./Build/docker.sh build` | build docker image |
| `./Build/docker.sh act` | build ACT binaries |
| `./Build/docker.sh examples` | build and run projects in Examples folder |
| `./Build/docker.sh all` | build ACT binaries and then build and run projects in Examples folder" |
| `./Build/docker.sh cli` | open bash session inside Docker with source code mapped to '/data' directory" |
| Command to run in Docker cli mode (sources are mapped to `/data` directory): |
| `./Build/build.sh` | build ACT binaries |
| `./Examples/build.sh` | build and run projects in Examples folder (including updating Bindings and Interfaces) |
| `./Examples/RTTI/build.sh` | build and run projects in Examples/RTTI folder (including updating Bindings and Interfaces) |
| `./Examples/Injection/build.sh` | build and run projects in Examples/RTTI folder (including updating Bindings and Interfaces) |
| `./Examples/RTTI/RTTI_component/Implementations/Cpp/build.sh` | build RTTI C++ library implementation |
| `./Examples/RTTI/RTTI_component/Implementations/Pascal/build.sh` | build RTTI Pascal library implementation |
| `./Examples/RTTI/RTTI_component/Examples/CppDynamic/build.sh` | build and run RTTI C++ Example (requres C++ and Pascal libraries) |
| `./Examples/RTTI/RTTI_component/Examples/Python/build.sh` | build and run RTTI Python Example (requres C++ and Pascal libraries) |
54 changes: 54 additions & 0 deletions Build/build.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

set -euxo pipefail

RUN () {
CMD=$1
OS="`uname`"
case $OS in
Linux*)
OSLD_LIBRARY_PATH="LD_LIBRARY_PATH=$2"
for i in "${@:3}"
do
OSLD_LIBRARY_PATH=$OSLD_LIBRARY_PATH:$i
done
eval $OSLD_LIBRARY_PATH $CMD
;;
Darwin*)
OSLD_LIBRARY_PATH="DYLD_LIBRARY_PATH=$2"
for i in "${@:3}"
do
OSLD_LIBRARY_PATH=$OSLD_LIBRARY_PATH:$i
done
eval $OSLD_LIBRARY_PATH $CMD
;;
Windows*) OSLD_LIBRARY_PATH='PATH=%PATH%;' ;;
*) ;;
esac
}

# Common initialization
OS="`uname`"
case $OS in
Linux*)
OSEXT='.linux'
OSLIBEXT='.so'
OSEXEEXT=
FPC_TARGET='linux'
;;
Windows*)
OSEXT='.exe'
OSLIBEXT='.dll'
OSEXEEXT='.exe'
FPC_TARGET='win64'
;;
Darwin*)
OSEXT='.darwin'
OSLIBEXT='.dylib'
OSEXEEXT=
FPC_TARGET='darwin'
;;
*) echo "[Failed] Can't detect OS. Only Windows, Linux and MacOS are supported."; exit 1; ;;
esac

export ACT=act$OSEXT
33 changes: 33 additions & 0 deletions Build/docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -euxo pipefail

cd "$(dirname "$0")"

case "$1" in
build)
docker build -t act-build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) .
;;
act)
docker run -it --rm -v $PWD/..:/data act-build /data/Build/build.sh
;;
examples)
docker run -it --rm -v $PWD/..:/data act-build /data/Examples/build.sh
;;
all)
docker run -it --rm -v $PWD/..:/data act-build /data/Build/build.sh
docker run -it --rm -v $PWD/..:/data act-build /data/Examples/build.sh
;;
cli)
docker run -it --rm -v $PWD/..:/data --entrypoint bash act-build -l
;;
*)
echo "Use one of availbale commands:"
echo " ./docker.sh build - build docker image"
echo " ./docker.sh act - build ACT binaries"
echo " ./docker.sh examples - build and run projects in Examples folder"
echo " ./docker.sh all - build ACT binaries and then build and run projects in Examples folder"
echo " ./docker.sh cli - open bash session inside Docker with source code mapped to '/data' directory"
exit 1
;;
esac
2 changes: 2 additions & 0 deletions Documentation/IDL.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Element **\<global>** of type **CT\_Global**
| errormethod | **ST\_Name** | required | | Specifies the name of the method used to query the last error that occured during the call of class's method. |
| versionmethod | **ST\_Name** | required | | Specifies the name of the method used to obtain the major, minor and micro version of the component. |
| prereleasemethod | **ST\_Name** | required | | Specifies the name of the method used to obtain the prerelease information of the component. |
| classtypeidmethod | **ST\_Name** | required | | Specifies the name of the method in base class used to get class type id of an object. |
| buildinfomethod | **ST\_Name** | optional | | Specifies the name of the method used to obtain the build information of the component. |
| injectionmethod | **ST\_Name** | optional | | Specifies the name of the method used to inject the symbollookupmethod another ACT component into this component at runtime. |
| symbollookupmethod | **ST\_Name** | optional | | Specifies the name of the method that returns the address of a given symbol exported by this component. |
Expand All @@ -198,6 +199,7 @@ The `acquiremethod`- and `releasemethod`-attributes must each be the name of a \
The `versionmethod`-attribute must be the name of a \<method> within the \<global> element of a component that has exactly three parameters. The three parameters MUST be of type `type="uint32"` and `pass="out"`.
The `prereleasemethod`-attribute is optional an can be the name of a \<method> within the \<global> element of a component that has two parameters.
The first parameter MUST be of type `type="bool"` and `pass="return"`, the second parameter MUST be of type `type="string"` and `pass="out"`.
The `classtypeidmethod`- must be the name of a \<method> within baseclassname \<class> element of a component that has exactly one parameter with `type="uint64"` and `pass="return"`.
The `buildinfomethod`-attribute is optional an can be the name of a \<method> within the \<global> element of a component that has two parameters.
The first parameter MUST be of type `type="bool"` and `pass="return"`, the second parameter MUST be of type `type="string"` and `pass="out"`.

Expand Down
6 changes: 5 additions & 1 deletion Examples/Injection/Calculation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<binding language="CppDynamic" indentation="tabs" />
<binding language="Pascal" indentation="2spaces" />
<binding language="Python" indentation="tabs" />
<binding language="Java" indentation="tabs" />
</bindings>
<implementations>
<implementation language="Cpp" indentation="tabs"/>
Expand All @@ -33,6 +34,9 @@
</errors>

<class name="Base">
<method name="ClassTypeId" description="Get Class Type Id">
<param name="ClassTypeId" type="uint64" pass="return" description="Class type as a 64 bits integer" />
</method>
</class>

<class name="Calculator" parent="Base" description="Sums up or multiplies a list of variables">
Expand Down Expand Up @@ -62,7 +66,7 @@
versionmethod="GetVersion" errormethod="GetLastError"
injectionmethod="InjectComponent"
symbollookupmethod="GetSymbolLookupMethod"
>
classtypeidmethod="ClassTypeId">
<method name="CreateCalculator" description="Creates a new Calculator instance">
<param name="Instance" type="class" class="Calculator" pass="return" description="New Calculator instance" />
</method>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright (C) 2019 Calculation developers

All rights reserved.

This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.

Abstract: This is an autogenerated C++-Header file in order to allow an easy
use of Calculation library
Expand All @@ -30,12 +30,23 @@ Interface version: 1.0.0

#include "numbers_dynamic.hpp"

#ifdef __cplusplus
extern "C" {
#endif

/*************************************************************************************************************************
Class definition for Base
**************************************************************************************************************************/

/**
* Get Class Type Id
*
* @param[in] pBase - Base instance.
* @param[out] pClassTypeId - Class type as a 64 bits integer
* @return error code or 0 (success)
*/
CALCULATION_DECLSPEC CalculationResult calculation_base_classtypeid(Calculation_Base pBase, Calculation_uint64 * pClassTypeId);

/*************************************************************************************************************************
Class definition for Calculator
**************************************************************************************************************************/
Expand Down Expand Up @@ -152,7 +163,9 @@ CALCULATION_DECLSPEC CalculationResult calculation_injectcomponent(const char *
*/
CALCULATION_DECLSPEC CalculationResult calculation_getsymbollookupmethod(Calculation_pvoid * pSymbolLookupMethod);

#ifdef __cplusplus
}
#endif

#endif // __CALCULATION_HEADER_CPP

Loading