comp.lang.ada
 help / color / mirror / Atom feed
* GDNative thick binding design
@ 2020-10-15 21:08 Michael Hardeman
  2020-10-16  6:38 ` Luke A. Guest
  2020-10-18 20:21 ` Per Sandberg
  0 siblings, 2 replies; 19+ messages in thread
From: Michael Hardeman @ 2020-10-15 21:08 UTC (permalink / raw)


I'm working on a binding to the Godot game engine for Ada.
Project link here: https://github.com/MichaelAllenHardeman/gdnative_ada

Once the game engine has loaded your dynamic library it will call the function *_nativescript_init (where * is the symbol_prefix defined in the library resource config file). This function is responsible for registering objects, object methods, and allocating any memory needed.

What I want to discuss here is that I'm a bit at a loss as to how to design a thick binding wrapper around this object registration pattern. So let me describe the pattern.

I have a very simple example translated from C using the thin binding is here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/master/examples/gdnative_c_example/src/simple.adb#L44

The objects must have a name, but may or may not override the constructor/destructor life cycle functions (which you pass in during registration)
There are
https://docs.godotengine.org/en/stable/classes/class_object.html#class-object

There is kind of a hierarchy at play as well:

the Node type extends Object 
https://docs.godotengine.org/en/stable/classes/class_node.html#node

and has addition life cycle events like _process (callback on each frame)
https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-process

Now I don't even know where to start defining something nice in Ada that would match this pattern and would hide all the nastiness from the C binding. I kind of want the tagged record hierarchy structure, with overriding functions, but it should only register methods with godot you've overridden. How would I know what methods have been overridden? I feel like I need some kind of generic or helper functions?

 I'm hoping some more experienced people might have some suggestions?



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-15 21:08 GDNative thick binding design Michael Hardeman
@ 2020-10-16  6:38 ` Luke A. Guest
  2020-10-16 16:39   ` Michael Hardeman
  2020-10-18 20:21 ` Per Sandberg
  1 sibling, 1 reply; 19+ messages in thread
From: Luke A. Guest @ 2020-10-16  6:38 UTC (permalink / raw)


On 15/10/2020 22:08, Michael Hardeman wrote:
> I'm working on a binding to the Godot game engine for Ada.
> Project link here: https://github.com/MichaelAllenHardeman/gdnative_ada
Interesting.

> What I want to discuss here is that I'm a bit at a loss as to how to design a thick binding wrapper around this object registration pattern. So let me describe the pattern.
> 
> I have a very simple example translated from C using the thin binding is here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/master/examples/gdnative_c_example/src/simple.adb#L44

Ok, so what you have now is a gcc generated binding, which isn't the 
nicest to work with.

What you really need to do is to start by wrapping up the thin inside a 
thick binding such that the plug-ins only use the thick binding and that 
any of the calls such as simple_constructor are wrapped, i.e.

Godot.Make(Instance : Godot.Root_Class; parameters...) -> calls 
simple_constructor(Instance.Internal_Pointer, parameters). Use overloads 
for this kind of stuff.

The way I bind to C is like this:

1) If it's a simple function that takes no parameters and returns 
nothing, then bind directly.

2) If it's a simple return type, use an expression function to bind.

3) Anything else gets a thick binding.

4) Types are mapped onto the C ones, so I lift out the definition from 
the thin binding and put it in the root package of the thick. I also 
rename so there's less repetitive stuff like GODOT_VARIANT_* and I case 
properly, this will be difficult for situations where identifiers are 
Ada keywords, so rename to something else completely if you have to, 
just document the change.

Essentially you want all the C nastiness inside the thick binding.

Look at SDLAda for some ideas, but this was done by hand. Anything 
generated by GCC needs to be hand massaged to be nicer imo.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16  6:38 ` Luke A. Guest
@ 2020-10-16 16:39   ` Michael Hardeman
  2020-10-16 18:09     ` Luke A. Guest
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-16 16:39 UTC (permalink / raw)


On Friday, October 16, 2020 at 2:38:38 AM UTC-4, Luke A. Guest wrote:

Thanks for the detailed reply. Unfortunately I think I didn't get my question across correctly.

I'm pretty familiar with most of the basic stuff I can do in Ada. I'm not asking for general advice on making a thick binding, I'm asking for help with one specific data structure/pattern. 

What is the best way to make Ada types/functions that wrap a particular thing:

I just pushed a work in progress branch where you can see what I'm struggling with:

https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/engine_hooks.adb#L29
https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/example_object.adb#L90

Is it possible to create type (tagged record maybe) who's dispatching methods automatically register in some way?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16 16:39   ` Michael Hardeman
@ 2020-10-16 18:09     ` Luke A. Guest
  2020-10-16 18:28       ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Luke A. Guest @ 2020-10-16 18:09 UTC (permalink / raw)


On 16/10/2020 17:39, Michael Hardeman wrote:
> On Friday, October 16, 2020 at 2:38:38 AM UTC-4, Luke A. Guest wrote:
> 
> Thanks for the detailed reply. Unfortunately I think I didn't get my question across correctly.
> 
> I'm pretty familiar with most of the basic stuff I can do in Ada. I'm not asking for general advice on making a thick binding, I'm asking for help with one specific data structure/pattern.
> 
> What is the best way to make Ada types/functions that wrap a particular thing:
> 
> I just pushed a work in progress branch where you can see what I'm struggling with:
> 
> https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/engine_hooks.adb#L29
> https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/example_object.adb#L90
> 
> Is it possible to create type (tagged record maybe) who's dispatching methods automatically register in some way?
> 

If you mean call Register(Context); on construction of the object, then 
have you looked at the factory stuff?

http://www.ada-auth.org/standards/12rm/html/RM-3-9.html#I2118

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16 18:09     ` Luke A. Guest
@ 2020-10-16 18:28       ` Michael Hardeman
  2020-10-16 18:31         ` Luke A. Guest
  2020-10-17 10:09         ` AdaMagica
  0 siblings, 2 replies; 19+ messages in thread
From: Michael Hardeman @ 2020-10-16 18:28 UTC (permalink / raw)


not when the object is constructed. I was wondering if something like the following were possible:

package GDNative.Thick.Objects is
  type Object is abstract tagged private;

  -- create abstract or null subprograms for each subprogram here:
  -- https://docs.godotengine.org/en/stable/classes/class_object.html#class-object
  function Name (Self : in Object'class) return Wide_String is abstract;
  procedure Initialize  (Self : in out Object'class) is null;
  -- etc...

private
  type Object is abstract tagged null record;
end;

But I need some way of knowing here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/engine_hooks.adb#L28 
what all the types that extend that object tagged type are, and what all the null methods they've chosen to override are. Kind of like the Java Class() style introspection.

I'm sure there must be some way of doing it better tho, with generics? I'm just not creative enough to see the solution atm.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16 18:28       ` Michael Hardeman
@ 2020-10-16 18:31         ` Luke A. Guest
  2020-10-21  2:58           ` Michael Hardeman
  2020-10-17 10:09         ` AdaMagica
  1 sibling, 1 reply; 19+ messages in thread
From: Luke A. Guest @ 2020-10-16 18:31 UTC (permalink / raw)


On 16/10/2020 19:28, Michael Hardeman wrote:

> But I need some way of knowing here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/engine_hooks.adb#L28

That's what the generic constructor wouild allow.

> what all the types that extend that object tagged type are, and what all the null methods they've chosen to override are. Kind of like the Java Class() style introspection.
> 
> I'm sure there must be some way of doing it better tho, with generics? I'm just not creative enough to see the solution atm.
> 

You can't know what the null methods are. Why do you even need to know?


I'm probably not understanding this, tbf.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16 18:28       ` Michael Hardeman
  2020-10-16 18:31         ` Luke A. Guest
@ 2020-10-17 10:09         ` AdaMagica
  1 sibling, 0 replies; 19+ messages in thread
From: AdaMagica @ 2020-10-17 10:09 UTC (permalink / raw)


> package GDNative.Thick.Objects is 
> type Object is abstract tagged private; 
> 
> -- create abstract or null subprograms for each subprogram here: 
> -- https://docs.godotengine.org/en/stable/classes/class_object.html#class-object 
> function Name (Self : in Object'class) return Wide_String is abstract; 
> procedure Initialize (Self : in out Object'class) is null; 
> -- etc... 
> 
> private 
> type Object is abstract tagged null record; 
> end; 
I do not know what you are trying to do, but I see a basic misunderstanding here wrt keyword abstract on operations.
It has two fundamentally different purposes:
* When used on a primitive operation of a nontagged type, it makes an inherited operation disappear, i.e. this operation does no longer exist, e.g.:
type T is range -42..42;
function "/" (L, R: T'Base) return T'Base is abstract;
* When used on a primitive operation of a tagged type, this operation is dispatching and must be overridden for derived types; e.g.
type T is abstrat tagged private;
procedure Op(X:T) is abstract;
type T1 is new T with private;
procedure Op(X:T1);
Now your
function Name (Self : in Object'class) return Wide_String is abstract;
is a classwide operation, not a primitive operation, so it canot be overridden. It is not a primitive operation of any type, so it just declares that such an operation cannot exist - a rather useless declaration.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-15 21:08 GDNative thick binding design Michael Hardeman
  2020-10-16  6:38 ` Luke A. Guest
@ 2020-10-18 20:21 ` Per Sandberg
  2020-10-21  3:34   ` Michael Hardeman
  1 sibling, 1 reply; 19+ messages in thread
From: Per Sandberg @ 2020-10-18 20:21 UTC (permalink / raw)


Well
My usual path is:
1) find bindings in other languages and try to understand their intention.
2) Generate  a 1:1 binding to the C API since that will provide a sound 
ground (this is an 100% automatic process).
3) Write the high level binding trying to mimic othef language bindings 
while keepoing an Ada twist to it,

With a minor effort I managed to to step one and two but step three is 
the hard one have a look on https://github.com/Ada-bindings-project/godot

/P

On 15/10/2020 23:08, Michael Hardeman wrote:
> I'm working on a binding to the Godot game engine for Ada.
> Project link here: https://github.com/MichaelAllenHardeman/gdnative_ada
> 
> Once the game engine has loaded your dynamic library it will call the function *_nativescript_init (where * is the symbol_prefix defined in the library resource config file). This function is responsible for registering objects, object methods, and allocating any memory needed.
> 
> What I want to discuss here is that I'm a bit at a loss as to how to design a thick binding wrapper around this object registration pattern. So let me describe the pattern.
> 
> I have a very simple example translated from C using the thin binding is here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/master/examples/gdnative_c_example/src/simple.adb#L44
> 
> The objects must have a name, but may or may not override the constructor/destructor life cycle functions (which you pass in during registration)
> There are
> https://docs.godotengine.org/en/stable/classes/class_object.html#class-object
> 
> There is kind of a hierarchy at play as well:
> 
> the Node type extends Object
> https://docs.godotengine.org/en/stable/classes/class_node.html#node
> 
> and has addition life cycle events like _process (callback on each frame)
> https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-process
> 
> Now I don't even know where to start defining something nice in Ada that would match this pattern and would hide all the nastiness from the C binding. I kind of want the tagged record hierarchy structure, with overriding functions, but it should only register methods with godot you've overridden. How would I know what methods have been overridden? I feel like I need some kind of generic or helper functions?
> 
>   I'm hoping some more experienced people might have some suggestions?
> 
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-16 18:31         ` Luke A. Guest
@ 2020-10-21  2:58           ` Michael Hardeman
  2020-10-21  6:59             ` Luke A. Guest
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-21  2:58 UTC (permalink / raw)


On Friday, October 16, 2020 at 2:32:30 PM UTC-4, Luke A. Guest wrote:
> On 16/10/2020 19:28, Michael Hardeman wrote: 
> 
> > But I need some way of knowing here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/feature/adventure_game/examples/adventure_game/src/engine_hooks.adb#L28
> That's what the generic constructor wouild allow.
> > what all the types that extend that object tagged type are, and what all the null methods they've chosen to override are. Kind of like the Java Class() style introspection. 
> > 
> > I'm sure there must be some way of doing it better tho, with generics? I'm just not creative enough to see the solution atm. 
> >
> You can't know what the null methods are. Why do you even need to know? 
> 
> 
> I'm probably not understanding this, tbf.

Can you explain the Generic Constructor some more? I need to use it now, but I can't exactly figure it out. I found this example: https://www.adacore.com/gems/ada-gem-19 but I have no idea how they can use the 'Input attribute as the constructor function. It doesn't match the signature requested by the generic at all.

I have a simple example I was trying to get working: https://ideone.com/f5bpr9
Do you think you could help me understand where I'm going wrong here?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-18 20:21 ` Per Sandberg
@ 2020-10-21  3:34   ` Michael Hardeman
  2020-10-21 16:16     ` Per Sandberg
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-21  3:34 UTC (permalink / raw)


why create a clone of my project idea with generated bindings instead of just contributing to the working one I've already made?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21  2:58           ` Michael Hardeman
@ 2020-10-21  6:59             ` Luke A. Guest
  2020-10-21 22:08               ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Luke A. Guest @ 2020-10-21  6:59 UTC (permalink / raw)


On 21/10/2020 03:58, Michael Hardeman wrote:

>> I'm probably not understanding this, tbf.
> 
> Can you explain the Generic Constructor some more? I need to use it now, but I can't exactly figure it out. I found this example: https://www.adacore.com/gems/ada-gem-19 but I have no idea how they can use the 'Input attribute as the constructor function. It doesn't match the signature requested by the generic at all.
> 
> I have a simple example I was trying to get working: https://ideone.com/f5bpr9
> Do you think you could help me understand where I'm going wrong here?
> 

I've never used it, but this might help 
https://www.adaic.org/resources/add_content/standards/05rat/html/Rat-2-6.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21  3:34   ` Michael Hardeman
@ 2020-10-21 16:16     ` Per Sandberg
  2020-10-21 22:48       ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Per Sandberg @ 2020-10-21 16:16 UTC (permalink / raw)


Michael
The "clone" is just an instantiation of the Binding template in the from 
the same github-project. The important thing is the total structure that 
is forcing hiding of the generated C-binding and it also makes it 
trivial to regenerate the low-level stuff when the header-files changes 
whats in the pipe as well is to semiautomatic generate the exported 
interfaces and implementations, but the initial attempts are to crude to 
put in the public they are just hacks so far.

I am happy to to contribute but since the original project in my opinion 
needed to much rework to start a discussion. I just instantiated my 
template for C-bindings, and completed the .c and .sed files.

And please see my project as an input with ideas on how I do believe 
bindings to larger C/C++ libraries shall be done and not as a new clone 
since i don't intend to do anything more with it that provide a 
structure for a binding project.

/Regards
/P

On 21/10/2020 05:34, Michael Hardeman wrote:
> why create a clone of my project idea with generated bindings instead of just contributing to the working one I've already made?
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21  6:59             ` Luke A. Guest
@ 2020-10-21 22:08               ` Michael Hardeman
  2020-10-21 23:22                 ` Luke A. Guest
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-21 22:08 UTC (permalink / raw)


On Wednesday, October 21, 2020 at 2:59:39 AM UTC-4, Luke A. Guest wrote:
> On 21/10/2020 03:58, Michael Hardeman wrote: 
> 
> >> I'm probably not understanding this, tbf. 
> > 
> > Can you explain the Generic Constructor some more? I need to use it now, but I can't exactly figure it out. I found this example: https://www.adacore.com/gems/ada-gem-19 but I have no idea how they can use the 'Input attribute as the constructor function. It doesn't match the signature requested by the generic at all. 
> > 
> > I have a simple example I was trying to get working: https://ideone.com/f5bpr9 
> > Do you think you could help me understand where I'm going wrong here? 
> >
> I've never used it, but this might help 
> https://www.adaic.org/resources/add_content/standards/05rat/html/Rat-2-6.html

Hey Luke,

I managed to figure it out: https://ideone.com/H9sV55

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21 16:16     ` Per Sandberg
@ 2020-10-21 22:48       ` Michael Hardeman
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Hardeman @ 2020-10-21 22:48 UTC (permalink / raw)


On Wednesday, October 21, 2020 at 12:17:00 PM UTC-4, persan....@gmail.com wrote:
> Michael 
> The "clone" is just an instantiation of the Binding template in the from 
> the same github-project. The important thing is the total structure that 
> is forcing hiding of the generated C-binding and it also makes it 
> trivial to regenerate the low-level stuff when the header-files changes 
> whats in the pipe as well is to semiautomatic generate the exported 
> interfaces and implementations, but the initial attempts are to crude to 
> put in the public they are just hacks so far. 
> 
> I am happy to to contribute but since the original project in my opinion 
> needed to much rework to start a discussion. I just instantiated my 
> template for C-bindings, and completed the .c and .sed files. 
> 
> And please see my project as an input with ideas on how I do believe 
> bindings to larger C/C++ libraries shall be done and not as a new clone 
> since i don't intend to do anything more with it that provide a 
> structure for a binding project. 
> 
> /Regards 
> /P
> On 21/10/2020 05:34, Michael Hardeman wrote: 
> > why create a clone of my project idea with generated bindings instead of just contributing to the working one I've already made? 
> >

I initially generated bindings to the headers, but they ended up needing significant work to be usable. I don't think automated generation of the binding is practical.
Since your program ends up being a dynamic library with 3 functions, and 1 of them is passed a pointer to the whole godot api as a single struct I don't think having multiple files is actually useful. It's a tricky API to use, and to bind to.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21 22:08               ` Michael Hardeman
@ 2020-10-21 23:22                 ` Luke A. Guest
  2020-10-26  3:38                   ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Luke A. Guest @ 2020-10-21 23:22 UTC (permalink / raw)


On 21/10/2020 23:08, Michael Hardeman wrote:

> Hey Luke,
> 
> I managed to figure it out: https://ideone.com/H9sV55
> 

I'm fairly sure that's almost right. I think the idea is that you only 
need to pass the parameters to a single function which then dispatches 
to the correct constructor for you.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-21 23:22                 ` Luke A. Guest
@ 2020-10-26  3:38                   ` Michael Hardeman
  2020-10-26  5:41                     ` Per Sandberg
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-26  3:38 UTC (permalink / raw)


On Wednesday, October 21, 2020 at 7:23:39 PM UTC-4, Luke A. Guest wrote:
> On 21/10/2020 23:08, Michael Hardeman wrote: 
> 
> > Hey Luke, 
> > 
> > I managed to figure it out: https://ideone.com/H9sV55 
> >
> I'm fairly sure that's almost right. I think the idea is that you only 
> need to pass the parameters to a single function which then dispatches 
> to the correct constructor for you.

Hey Luke,

https://github.com/MichaelAllenHardeman/gdnative_ada
I've done an initial pass on the thick binding. Do you think you could give me some pointers on where I could do better?
I have a feeling there is a way to do GDNative.Thick.Objects better

Still, as is it's pretty nice to use. It only takes just a tiny bit of user code to get an object registered and running a function on each frame.
https://github.com/MichaelAllenHardeman/gdnative_ada/tree/master/examples/adventure_game/src

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-26  3:38                   ` Michael Hardeman
@ 2020-10-26  5:41                     ` Per Sandberg
  2020-10-26 13:53                       ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Per Sandberg @ 2020-10-26  5:41 UTC (permalink / raw)


Real good work.

And especially that you started with a "game" that way you usually get a 
better feeling for what is needed, and to start to explore from the game 
side with the focus How do to get an Ada api not a C api written i Ada 
is a realy good path.

But I still think that the binding is kind of upside down with the 
Low-level stuff on the top visible for everyone and the think bindings 
highlighted as such instead of the other way around.

And on the project structure, for the "library project Adventure"  I 
would have used and exended project 'library project Adventure extends 
"../../gdnative_ada.gpr" is', by doing that it's possible to move the 
methods in engine_hooks up to the root project and only have the "game" 
stuff in the adventure project.

/Regards
/P

On 26/10/2020 04:38, Michael Hardeman wrote:
> On Wednesday, October 21, 2020 at 7:23:39 PM UTC-4, Luke A. Guest wrote:
>> On 21/10/2020 23:08, Michael Hardeman wrote:
>>
>>> Hey Luke,
>>>
>>> I managed to figure it out: https://ideone.com/H9sV55
>>>
>> I'm fairly sure that's almost right. I think the idea is that you only
>> need to pass the parameters to a single function which then dispatches
>> to the correct constructor for you.
> 
> Hey Luke,
> 
> https://github.com/MichaelAllenHardeman/gdnative_ada
> I've done an initial pass on the thick binding. Do you think you could give me some pointers on where I could do better?
> I have a feeling there is a way to do GDNative.Thick.Objects better
> 
> Still, as is it's pretty nice to use. It only takes just a tiny bit of user code to get an object registered and running a function on each frame.
> https://github.com/MichaelAllenHardeman/gdnative_ada/tree/master/examples/adventure_game/src
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-26  5:41                     ` Per Sandberg
@ 2020-10-26 13:53                       ` Michael Hardeman
  2020-10-27  3:34                         ` Michael Hardeman
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Hardeman @ 2020-10-26 13:53 UTC (permalink / raw)



> Real good work. 
> 
> And especially that you started with a "game" that way you usually get a 
> better feeling for what is needed, and to start to explore from the game 
> side with the focus How do to get an Ada api not a C api written i Ada 
> is a realy good path. 
> 
> But I still think that the binding is kind of upside down with the 
> Low-level stuff on the top visible for everyone and the think bindings 
> highlighted as such instead of the other way around. 
> 
> And on the project structure, for the "library project Adventure" I 
> would have used and exended project 'library project Adventure extends 
> "../../gdnative_ada.gpr" is', by doing that it's possible to move the 
> methods in engine_hooks up to the root project and only have the "game" 
> stuff in the adventure project. 
> 
> /Regards 
> /P

Hey Persan,

Thanks for the words of encouragement.
Those changes don't sound too difficult. I'm not sure if I'll be able to truly hide the engine hook stuff. I'll try it out on a branch today.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: GDNative thick binding design
  2020-10-26 13:53                       ` Michael Hardeman
@ 2020-10-27  3:34                         ` Michael Hardeman
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Hardeman @ 2020-10-27  3:34 UTC (permalink / raw)


On Monday, October 26, 2020 at 9:53:52 AM UTC-4, Michael Hardeman wrote:
> > Real good work. 
> > 
> > And especially that you started with a "game" that way you usually get a 
> > better feeling for what is needed, and to start to explore from the game 
> > side with the focus How do to get an Ada api not a C api written i Ada 
> > is a realy good path. 
> > 
> > But I still think that the binding is kind of upside down with the 
> > Low-level stuff on the top visible for everyone and the think bindings 
> > highlighted as such instead of the other way around. 
> > 
> > And on the project structure, for the "library project Adventure" I 
> > would have used and exended project 'library project Adventure extends 
> > "../../gdnative_ada.gpr" is', by doing that it's possible to move the 
> > methods in engine_hooks up to the root project and only have the "game" 
> > stuff in the adventure project. 
> > 
> > /Regards 
> > /P
> Hey Persan, 
> 
> Thanks for the words of encouragement. 
> Those changes don't sound too difficult. I'm not sure if I'll be able to truly hide the engine hook stuff. I'll try it out on a branch today.

I've done a pass pulling the Thick bindings up a level and pushing the thin bindings down a level. Right now they are on a separate branch. There is some stuff I can clean up that would make me happier about it. I still don't see how to move the engine_hooks stuff into the library level code because the External_Names names that need to be exported for those functions have a prefix "adventure_" that is configured at the project level. I think I could get away with it maybe if I use gnatprep preprocessor in some way https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Integrated-Preprocessing.html#Integrated-Preprocessing

https://github.com/MichaelAllenHardeman/gdnative_ada/tree/architecture-refactor

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-10-27  3:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 21:08 GDNative thick binding design Michael Hardeman
2020-10-16  6:38 ` Luke A. Guest
2020-10-16 16:39   ` Michael Hardeman
2020-10-16 18:09     ` Luke A. Guest
2020-10-16 18:28       ` Michael Hardeman
2020-10-16 18:31         ` Luke A. Guest
2020-10-21  2:58           ` Michael Hardeman
2020-10-21  6:59             ` Luke A. Guest
2020-10-21 22:08               ` Michael Hardeman
2020-10-21 23:22                 ` Luke A. Guest
2020-10-26  3:38                   ` Michael Hardeman
2020-10-26  5:41                     ` Per Sandberg
2020-10-26 13:53                       ` Michael Hardeman
2020-10-27  3:34                         ` Michael Hardeman
2020-10-17 10:09         ` AdaMagica
2020-10-18 20:21 ` Per Sandberg
2020-10-21  3:34   ` Michael Hardeman
2020-10-21 16:16     ` Per Sandberg
2020-10-21 22:48       ` Michael Hardeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox