comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Thickening Ada GTK or Vala Binding ?
Date: Thu, 27 Dec 2012 20:07:21 +0100
Date: 2012-12-27T20:07:21+01:00	[thread overview]
Message-ID: <1b6lxwgy1k8dv.80a4pq6ce32b$.dlg@40tude.net> (raw)
In-Reply-To: 0c94b952-2bdf-4f25-98a3-91a67ed2355d@googlegroups.com

On Thu, 27 Dec 2012 09:45:40 -0800 (PST), Patrick wrote:

> My plan was to write more C functions to hide away as much GTK complexity
> as possible and to bind to these functions.

Won't work. C API of Gtk are more complex than GtkAda API.

> So for instance GTK uses glib
> types a lot but I donοΏ½t want to have strange looking gint types etc in
> Ada, not to mention access types.

Glib is essential to Gtk. You cannot write anything more or less elaborated
without using GObject, GValue, GList etc.

GInt is the type used by Gtk for signed integers. Access types are used
because Gtk does. Remember Gtk is in C. C does not have arrays and cannot
return anything on the stack except from scalar types. GtkAda just follows
C, simplifying it where possible. E.g. Get_Text returns String rather than
the mess the native C API does (e.g. gtk_entry_get_text). As I said, GtkAda
is simpler than C API.

> There is tons of C Gtk documentation, examples and a large community to
> call for help with on.

You have to learn Gtk in order to be able to use it. Once you did, the
problems you have now would simply disappear (and others, real problems
would appear in their place)

> I donοΏ½t see how anyone could use it unless they had a very strong
> understanding of both Ada and C GTK.

Learning Gtk is an absolute requirement.

> If I was going to write c functions to hide away the GTK ugliness why
> donοΏ½t just write them in Ada and help the community.

1. Nobody needs that. For people who know Gtk these would be useless. 

2. It would be impossible to design because if you know Gtk you cannot
understand the logic and difficulties of somebody who does not know it.

If you start writing the stuff, you will drop it once you gain enough
knowledge of Gtk, to see all pointlessness of the task.
 
> Does anyone have some small code examples that might help with this?

Small Gtk code examples can be found in rosetta code. But, honestly, there
is only one example needed: a window with one button. The rest is concrete
Gtk widgets and objects which are learnt by doing.

> Or tips on how I could make another wrapper around Ada GTK ?

By calling Ada subprogram from another Ada subprogram, I suppose.

Why anybody would need Ada wrappers around Ada?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-12-27 19:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 17:45 Thickening Ada GTK or Vala Binding ? Patrick
2012-12-27 19:07 ` Dmitry A. Kazakov [this message]
2012-12-27 21:53   ` Patrick
2012-12-28  7:57     ` Dmitry A. Kazakov
2012-12-28 23:51       ` Randy Brukardt
2013-01-13  6:24         ` gautier_niouzes
2013-01-15  0:34           ` Randy Brukardt
2012-12-27 22:58 ` Brian Drummond
2012-12-27 23:06   ` Patrick
2012-12-28  9:53     ` Brian Drummond
2012-12-28  0:53 ` Robert Matthews
2012-12-28  1:41   ` Patrick
2012-12-28  2:03     ` Robert Matthews
2012-12-28  5:22 ` Vadim Godunko
2012-12-28  7:38   ` Vadim Godunko
2013-02-07  9:34   ` Gour
2013-02-08  6:49     ` Gour
2012-12-28 11:34 ` Justin Time
2012-12-28 23:56   ` Randy Brukardt
2013-01-11  1:40     ` Saulo
2013-01-11 12:02       ` Jacob Sparre Andersen
2013-01-11 20:14         ` Dmitry A. Kazakov
replies disabled

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