comp.lang.ada
 help / color / mirror / Atom feed
* Ada Library, called, returns and continues ?
@ 2012-12-16 19:21 Patrick
  2012-12-16 19:51 ` Simon Wright
  2012-12-16 20:26 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 22+ messages in thread
From: Patrick @ 2012-12-16 19:21 UTC (permalink / raw)


so I have been going around in circles(as usual)with a problem. I would like to use Ada as a library from a single threaded GUI application.

I don't want the GUI to block and I want the freedom to use Ada's threading model without too many restrictions.

I keep changing my mind but today I looking into the Fox Toolkit. I am thinking about writing a single threaded C++ or Ruby application and then calling Ada from it.

I was thinking about using UNIX sockets or dbus and have the two live separate lives, just communicating as needed but I am wondering if I am missing something simple. If I write and compile an Ada library into my GUI app, is it possible to call an Ada function, have it return quickly but then have Ada code continue to execute using threading?

Honestly I have not used Ada's threading yet but could the GUI call an entry, perhaps after an initialization call to start the threads?



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

* Re: Ada Library, called, returns and continues ?
  2012-12-16 19:21 Ada Library, called, returns and continues ? Patrick
@ 2012-12-16 19:51 ` Simon Wright
  2012-12-16 20:26 ` Dmitry A. Kazakov
  1 sibling, 0 replies; 22+ messages in thread
From: Simon Wright @ 2012-12-16 19:51 UTC (permalink / raw)


Patrick <patrick@spellingbeewinnars.org> writes:

> Honestly I have not used Ada's threading yet but could the GUI call an
> entry, perhaps after an initialization call to start the threads?

Yes.



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

* Re: Ada Library, called, returns and continues ?
  2012-12-16 19:21 Ada Library, called, returns and continues ? Patrick
  2012-12-16 19:51 ` Simon Wright
@ 2012-12-16 20:26 ` Dmitry A. Kazakov
  2012-12-16 23:13   ` Patrick
  1 sibling, 1 reply; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-16 20:26 UTC (permalink / raw)


On Sun, 16 Dec 2012 11:21:16 -0800 (PST), Patrick wrote:

> I don't want the GUI to block and I want the freedom to use Ada's
> threading model without too many restrictions.

This is understandable
 
> I keep changing my mind but today I looking into the Fox Toolkit. I am
> thinking about writing a single threaded C++ or Ruby application and then
> calling Ada from it.

Why not to use something more Ada friendly? Anyway, single threaded GUI
means what? One thread = blocking.
 
> If I write and compile an Ada library into my
> GUI app, is it possible to call an Ada function, have it return quickly
> but then have Ada code continue to execute using threading?

Surely, but that would not be single-threaded anymore.

> Honestly I have not used Ada's threading yet

You should

> but could the GUI call an
> entry, perhaps after an initialization call to start the threads?

Yes, this is rather trivial. But you also need a communication channel back
to the GUI thread = asynchronous access to the GUI events, messages
whatever. E.g. a working task which modifies a GUI's progress bar as it
does the job. It is more than just starting tasks. There are various
solutions for this which always depend on the GUI framework at hand.

I have no idea about the Fox Toolkit. You should find out ways of doing
this there. Usually, when the framework is not natively multi-tasking, you
use polling, timer events, idle callbacks to implement the backward channel
(task to the main messages loop).

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-16 20:26 ` Dmitry A. Kazakov
@ 2012-12-16 23:13   ` Patrick
  2012-12-17  8:59     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 22+ messages in thread
From: Patrick @ 2012-12-16 23:13 UTC (permalink / raw)
  Cc: mailbox

Hi Dmitry

I was hoping you would post, thanks.

I seriously considered using your GTK contributions. It seems perfect for me except for the fact that it involves GTK.  I am intimidated with the QT, GTK and WxWidgets landscape right now. I know I can get by just using their APIs but if I want to do something special their enormous codebases are incomprehensible for me. I have been focusing on FLTK, Fox, Tk and don't laugh but Xforms. At under 100K lines of code(Tk is a little more) someone at my competence level can still make changes/additions much like you did with GTK.

It may be trivial but once I am able to call entries I can turn a single threaded application into a multi-threaded one. One communication channel back that I am considering is returning a string  that would contain code that an interpreted language could eval. I know eval is evil but if used sparingly I think it could be quite powerful and I would not always have to return back code, it could just be a new value for a function to use with a widget.

Thanks again, i am going to go for it-Patrick



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

* Re: Ada Library, called, returns and continues ?
  2012-12-16 23:13   ` Patrick
@ 2012-12-17  8:59     ` Dmitry A. Kazakov
  2012-12-17 15:58       ` Patrick
  0 siblings, 1 reply; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-17  8:59 UTC (permalink / raw)


On Sun, 16 Dec 2012 15:13:06 -0800 (PST), Patrick wrote:

> I am intimidated with the QT, GTK and WxWidgets landscape right now.

Well, there is a reason for that. GTK and Qt are trying to provide an
OS-independent layer which brings pretty much everything with it.

> I have been focusing on FLTK, Fox, Tk and don't laugh but Xforms. At under
> 100K lines of code(Tk is a little more)

100K lines of GUI code or 100K lines altogether? Anyway it is unrealistic
to hope that you could keep your code tight when using an alien non-Ada
library. Code reduction can only be achieved when the library has a native
Ada interface and deploy OO techniques at full.

> It may be trivial but once I am able to call entries I can turn a single
> threaded application into a multi-threaded one.

No, that would not if you did all work during the entry call (rendezvous).
Because then both the caller and the callee tasks stayed synchronized.

GUI libraries are event-driven, it is a wholly different model which is
inherently synchronous. Calls to entries initially change nothing. You have
to design the GUI in a completely different manner, which is necessarily
complex because does not fit into the model.

> One communication channel
> back that I am considering is returning a string  that would contain code
> that an interpreted language could eval.

You also need to block the Ada task until its return is accepted or else
implement a queue of requests (blocking upon queueing the request).

You also need support for unsolicited calls from Ada tasks. Consider a
progress bar indicator driven by an Ada task. At some point it should send
a message to the main thread to update the bar state. The main thread has
no idea about when and if that could happen.

An alternative solution (used in RT systems) is polling. This is sometimes
simpler to implement for small atomic objects, but it makes GUI design even
more complicated.

> I know eval is evil but if used
> sparingly I think it could be quite powerful

No, it is not. Think about passing parameters forth and back within the
string. You will have to bind them to some local variables. If that looks
simple to you, look at ODBC and other DB interfaces using SQL. They have
exactly this problem - dressing proper calls into an interpreted SQL
string. The result is utter mess.

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-17  8:59     ` Dmitry A. Kazakov
@ 2012-12-17 15:58       ` Patrick
  2012-12-17 17:08         ` Simon Wright
  2012-12-17 18:09         ` Dmitry A. Kazakov
  0 siblings, 2 replies; 22+ messages in thread
From: Patrick @ 2012-12-17 15:58 UTC (permalink / raw)
  Cc: mailbox

Hi Dmitry

"100K lines of GUI code or 100K lines altogether? "

The whole toolkit. I can understand this with difficulty. I was thinking about reworking FLTK. I wanted to write a C wrapper around it's C++ core and then bind to this. I was thinking the widgets could then be rewritten in Ada. I still might do this but my family demands have intensified again. I haven't programmed in a month and I looking for something easier.

I was thinking that if I could bind an Ada entry to C, I could use a gui toolkits idle callback to retrieve information that could be processed in the back ground such as data being collected from an instrument, a bitmap image being generated from svg etc..

If a protected object and it's entries are bound to a C/C++ application with it's own main, do you think the Ada threads will begin when the C main is called or would I need to create an initialization for them? If they just started, main C could call an entry or If I used a protected record I could also access this as a struct and retrieve data this way. Do you think I could send data back and forth through the protected record?


'You also need support for unsolicited calls from Ada tasks. Consider a
progress bar indicator driven by an Ada task. At some point it should send
a message to the main thread to update the bar state. The main thread has
no idea about when and if that could happen. "

yes, I don't know how to do this but perhaps I can do this in a year or so when I am further along.

> I know eval is evil but if used
> sparingly I think it could be quite powerful

"No, it is not."

Okay, I stay away from it.

Thanks again for your feedback.




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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 15:58       ` Patrick
@ 2012-12-17 17:08         ` Simon Wright
  2012-12-17 17:43           ` Patrick
  2012-12-17 18:09         ` Dmitry A. Kazakov
  1 sibling, 1 reply; 22+ messages in thread
From: Simon Wright @ 2012-12-17 17:08 UTC (permalink / raw)


Patrick <patrick@spellingbeewinnars.org> writes:

> If a protected object and it's entries are bound to a C/C++
> application with it's own main, do you think the Ada threads will
> begin when the C main is called or would I need to create an
> initialization for them? If they just started, main C could call an
> entry or If I used a protected record I could also access this as a
> struct and retrieve data this way. Do you think I could send data back
> and forth through the protected record?

[1] tells how to bind (how to invoke gnatbind) for a non-Ada main
program; this generates the necessary Ada elaboration code, and your C
calls "adainit" to do the elaboration, start tasks etc. There's also an
"adafinal", which I've never had occasion to call, and I believe you can
get GNAT to use a different name if necessary.

C can't call POs or task entries directly, you'd need to write Ada
subprograms to do that and arrange to call them from the C.

[1] http://docs.adacore.com/gnat-unw-docs/html/gnat_ugn_5.html#SEC70



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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 17:08         ` Simon Wright
@ 2012-12-17 17:43           ` Patrick
  0 siblings, 0 replies; 22+ messages in thread
From: Patrick @ 2012-12-17 17:43 UTC (permalink / raw)


Thanks Simon !

I have 53lbs of Ada books here and I could not find an example of binding to a entry !

I think I have enough to give this a shot now.

Once I am done I will also try to post some code to the Lua list. There are lots of other languages that could benefit from a concurrent library. Ada needs promotion




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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 15:58       ` Patrick
  2012-12-17 17:08         ` Simon Wright
@ 2012-12-17 18:09         ` Dmitry A. Kazakov
  2012-12-17 19:41           ` Patrick
  1 sibling, 1 reply; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-17 18:09 UTC (permalink / raw)


On Mon, 17 Dec 2012 07:58:48 -0800 (PST), Patrick wrote:

> "100K lines of GUI code or 100K lines altogether? "
> 
> The whole toolkit.

There should be some hidden code somewhere else.

> I was thinking that if I could bind an Ada entry to C, I could use a gui
> toolkits idle callback to retrieve information that could be processed in
> the back ground such as data being collected from an instrument, a bitmap
> image being generated from svg etc..

GtkAda contributions which does something close to this, you could use it
as a template for your code. However, as Simon wrote, using Ada with the
C++'s main requires additional work of initializing Ada's run-time. 

>> 'You also need support for unsolicited calls from Ada tasks. Consider a
>> progress bar indicator driven by an Ada task. At some point it should send
>> a message to the main thread to update the bar state. The main thread has
>> no idea about when and if that could happen. "
> 
> yes, I don't know how to do this but perhaps I can do this in a year or so
> when I am further along.

Or come to the conclusion that this cannot be done. When you say that a
tool kit X is simpler than the tool kit Y, this implies that you already
know how to accomplish all necessary tasks in X.

This is a typical mistake - look, how easy to create a window with a button
in it using X! Yes it is easy and you probably could accomplish 80% of the
project in 20% less time than in Y. The caveat is that the rest 20% could
require 1000% as much, if ever doable.

I know nothing about your toolkit X, I only warn you for this sort of
mistakes.

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 18:09         ` Dmitry A. Kazakov
@ 2012-12-17 19:41           ` Patrick
  2012-12-17 21:26             ` Dmitry A. Kazakov
  0 siblings, 1 reply; 22+ messages in thread
From: Patrick @ 2012-12-17 19:41 UTC (permalink / raw)
  Cc: mailbox

"Or come to the conclusion that this cannot be done. When you say that a
tool kit X is simpler than the tool kit Y, this implies that you already
know how to accomplish all necessary tasks in X.

This is a typical mistake - look, how easy to create a window with a button
in it using X! Yes it is easy and you probably could accomplish 80% of the
project in 20% less time than in Y. The caveat is that the rest 20% could
require 1000% as much, if ever doable.

I know nothing about your toolkit X, I only warn you for this sort of
mistakes. "

Hi Dmitry

Actually my fear of GTK/QT/WxWidgets is actually  because of that last 20%. Even with GTKs excellent documentation and widespread use, I found myself at a dead end least year when I wanted to use it with Ada outside of the Ada GTK binding. I read through the Ada binding and tried to read through GTK itself too. Just the build system alone is too much for me, I don't know how to add in a single file let alone do anything creative with teh toolkit on a lower level. I can use the API, that's it.

So to use Fltk as an example, the src directory gives this:
cpp:          55726 (61.71%)
ansic:        34306 (37.99%)
sh:             273 (0.30%)
Total Physical Source Lines of Code (SLOC)                = 90,305

With the sloccount command and the whole project gives 198,046 but this includes other libraries and test code. I understand 30% of the code now and I could add stuff in.

You and I are in totally different places. You probably don't know how a spectrofluoromter works but I have <10% of your programming knowledge base. It's critical for me to be able to use a little code as possible and to be able to understand well or it will just be bug-city.

When I said "when I am further along" I mean further along in my studies.

Thanks



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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 19:41           ` Patrick
@ 2012-12-17 21:26             ` Dmitry A. Kazakov
  2012-12-17 23:42               ` Patrick
  0 siblings, 1 reply; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-17 21:26 UTC (permalink / raw)


On Mon, 17 Dec 2012 11:41:46 -0800 (PST), Patrick wrote:

> I found
> myself at a dead end least year when I wanted to use it with Ada outside
> of the Ada GTK binding.

I don't understand this. To use GTK outside GtkAda bindings? What for?

> I read through the Ada binding and tried to read
> through GTK itself too. Just the build system alone is too much for me, I
> don't know how to add in a single file let alone do anything creative with
> teh toolkit on a lower level. I can use the API, that's it.

This looks like a project management problem rather than Gtk/GtkAda.

> It's critical for me to be able to use a little code as possible and
> to be able to understand well or it will just be bug-city.

In that case you should find a GUI framework for which there already exist
ready-to-use bindings. If I ever looked into Gtk sources then only for
finding Gtk bugs. It would be a horror scenario if looking into the sources
were required for daily GUI developing. Gtk is far from perfect but at
least this torture you are spared from. I am sure that the same could be
said about any other popular GUI framework.

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 21:26             ` Dmitry A. Kazakov
@ 2012-12-17 23:42               ` Patrick
  2012-12-18  0:30                 ` Randy Brukardt
                                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Patrick @ 2012-12-17 23:42 UTC (permalink / raw)
  Cc: mailbox


"I don't understand this. To use GTK outside GtkAda bindings? What for? "

Yeah, I can understand this reaction, it is weird. Things might have changed now but basically I couldn't understand the Ada binding in the detail I wanted. I was thinking about writing a skeleton C application and then binding Ada to it to sort of script it. I failed at the time.

"in that case you should find a GUI framework for which there already exist
ready-to-use bindings. If I ever looked into Gtk sources then only for
finding Gtk bugs. It would be a horror scenario if looking into the sources
were required for daily GUI developing. Gtk is far from perfect but at
least this torture you are spared from. I am sure that the same could be
said about any other popular GUI framework. "

Yes, I understand your logic. However if I ever have the time or acquire the skills I would like to write an entire toolkit directly in Ada. I think the only feasible way to do this is to port the code over from another existing toolkit and to pick a very small one to port.

-Patrick




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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 23:42               ` Patrick
@ 2012-12-18  0:30                 ` Randy Brukardt
  2012-12-18  1:36                   ` Patrick
  2012-12-18  9:17                 ` Dmitry A. Kazakov
       [not found]                 ` <2nr1d89tvkc3h0dvcd62tpsf1vujsdb09o@invalid.netcom.com>
  2 siblings, 1 reply; 22+ messages in thread
From: Randy Brukardt @ 2012-12-18  0:30 UTC (permalink / raw)


"Patrick" <patrick@spellingbeewinnars.org> wrote in message 
news:6f3c34d9-504a-494c-9157-2cf2649e4776@googlegroups.com...
> Yes, I understand your logic. However if I ever have the time or acquire 
> the skills I
> would like to write an entire toolkit directly in Ada. I think the only 
> feasible way to
> do this is to port the code over from another existing toolkit and to pick 
> a very small one
> to port.

I'm afraid this is a typical newcomer idea. (Along with building your own 
Ada compiler or an Ada operating system.) As someone who has managed a 
project to create an Ada "toolkit" (Claw), I can certainly say that it seems 
many times easier than it appears. Moreover, it is really simple to make 
fundemental design decisions that makes it much harder to create and/or use 
than necessary (and usually it is too much work to change them, as you'll 
only find out the consequences after it gets into significant usage). And 
then, if people actually start using your toolkit, then you'll have another 
problem of trying to upgrade it without breaking compatibility. This sort of 
thing is not for the faint-of-heart, and rarely leads anywhere but a lot of 
effort wasted.

                                                Randy.






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

* Re: Ada Library, called, returns and continues ?
  2012-12-18  0:30                 ` Randy Brukardt
@ 2012-12-18  1:36                   ` Patrick
  2012-12-18 23:10                     ` Randy Brukardt
  0 siblings, 1 reply; 22+ messages in thread
From: Patrick @ 2012-12-18  1:36 UTC (permalink / raw)


Hi Randy

Your scaring me a bit. Do you think there is something fundamental about Ada that makes it hard to create bindings or projects?

I am not saying I can do it, but I am thinking that porting 50K lines of C++ to Ada should not be so hard, perhaps a month or two of full time work.




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

* Re: Ada Library, called, returns and continues ?
  2012-12-17 23:42               ` Patrick
  2012-12-18  0:30                 ` Randy Brukardt
@ 2012-12-18  9:17                 ` Dmitry A. Kazakov
  2012-12-18 15:00                   ` Patrick
  2012-12-18 16:50                   ` Robert A Duff
       [not found]                 ` <2nr1d89tvkc3h0dvcd62tpsf1vujsdb09o@invalid.netcom.com>
  2 siblings, 2 replies; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-18  9:17 UTC (permalink / raw)


On Mon, 17 Dec 2012 15:42:35 -0800 (PST), Patrick wrote:

> "I don't understand this. To use GTK outside GtkAda bindings? What for? "
> 
> Yeah, I can understand this reaction, it is weird. Things might have
> changed now but basically I couldn't understand the Ada binding in the
> detail I wanted.

Implementation of bindings or the way of using them?

> I was thinking about writing a skeleton C application and
> then binding Ada to it to sort of script it. I failed at the time.

No wonder. C makes things only more complicated. If you have difficulties
with Ada, multiply that by two for C, and once more by two for integration
C and Ada components.
 
> "in that case you should find a GUI framework for which there already exist
> ready-to-use bindings. If I ever looked into Gtk sources then only for
> finding Gtk bugs. It would be a horror scenario if looking into the sources
> were required for daily GUI developing. Gtk is far from perfect but at
> least this torture you are spared from. I am sure that the same could be
> said about any other popular GUI framework. "
> 
> Yes, I understand your logic. However if I ever have the time or acquire
> the skills I would like to write an entire toolkit directly in Ada. I
> think the only feasible way to do this is to port the code over from
> another existing toolkit and to pick a very small one to port.

I see, it is difficult to learn how to drive a car. In order to ease the
process you decided to build a new car by yourself... (:-))
 
-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18  9:17                 ` Dmitry A. Kazakov
@ 2012-12-18 15:00                   ` Patrick
  2012-12-18 15:37                     ` Dmitry A. Kazakov
  2012-12-18 16:50                   ` Robert A Duff
  1 sibling, 1 reply; 22+ messages in thread
From: Patrick @ 2012-12-18 15:00 UTC (permalink / raw)
  Cc: mailbox

"Implementation of bindings or the way of using them? "

Actually both

"I see, it is difficult to learn how to drive a car. In order to ease the
process you decided to build a new car by yourself... (:-)) "

Actually both of the cases are due to my desire to understand the code I am writing even at the expense of power. I don't mean to knock the hard work of the GTk binding but it is difficult for new people to get started with it. Now I can manage(I might try again soon) because I have made progress with C/C++ in the past few months but I couldn't understand many lines in the examples a few months ago.

To pick one at random:
Cal : access Gtk_Calendar_Record'Class

Now I know this is a pointer to a C object but only because I basically get C/C++ now.

If there was a simple little Ada widget toolkit that only had a C/C++ core, then I think it would be very pleasant for newbies to program in, I personally don't like messing around with pointers. It seems to me that C and friends are so strong these days because of inertia alone. I would love to work with more Ada code that was not just a thin binding.



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18 15:00                   ` Patrick
@ 2012-12-18 15:37                     ` Dmitry A. Kazakov
  2012-12-18 16:14                       ` Patrick
  0 siblings, 1 reply; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-18 15:37 UTC (permalink / raw)


On Tue, 18 Dec 2012 07:00:41 -0800 (PST), Patrick wrote:

> To pick one at random:
> Cal : access Gtk_Calendar_Record'Class
> 
> Now I know this is a pointer to a C object but only because I basically get C/C++ now.

No it is a pointer to an Ada object associated with the C object
implementing the Gtk widget. GtkAda creates an Ada object for each Gtk
widget (and any other object) created by means of GtkAda. This object is
used as a proxy to the native C object when calls are made from Ada side.
It must be this way because Gtk has object-oriented design.

Gtk was developed with interoperability to other languages in mind. Many
GUI frameworks use a similar technique, when the widget carries an opaque
pointer to some user data.

C to Ada path works as follows. Gtk callbacks are captured by private
GtkAda's subroutines. They must exist anyway, since C convention is
required. These get the pointer to XXX_Record'Class from the C object and
route the call to the corresponding primitive operation of the Ada object. 

The user need not know all this mechanics. Everything looks like calling
Ada operations and Ada operations being called.

> If there was a simple little Ada widget toolkit that only had a C/C++
> core,

Meaning?

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18 15:37                     ` Dmitry A. Kazakov
@ 2012-12-18 16:14                       ` Patrick
  2012-12-18 17:25                         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 22+ messages in thread
From: Patrick @ 2012-12-18 16:14 UTC (permalink / raw)
  Cc: mailbox

> If there was a simple little Ada widget toolkit that only had a C/C++ 
> core, 

"Meaning? "

Thanks for the GTK help. Again I don't mean to knock the work been done but wouldn't be nice if it was Ada much further down.Yes we can make meta widgets in Ada-GTK but adding a lower level widget would likely involve C with Ada-GTK. If all the widgets were coded in Ada and the primitives in the C/C++ core were nicely wrapped and isolated, then a new programmer could just learn Ada and not have to worry about C/C++. Again I have very limited experience with threading but I am guessing that if certain widgets were also protected, it would make writing a multi-threading GUI APP much nicer.

I would also like to be able to fly and fire lighting bolt out of my butt. Not sure which is more realistic



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18  9:17                 ` Dmitry A. Kazakov
  2012-12-18 15:00                   ` Patrick
@ 2012-12-18 16:50                   ` Robert A Duff
  1 sibling, 0 replies; 22+ messages in thread
From: Robert A Duff @ 2012-12-18 16:50 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> No wonder. C makes things only more complicated. If you have difficulties
> with Ada, multiply that by two for C, ...

According to the Zeigler paper, it's more like a factor of 3.

>...and once more by two for integration
> C and Ada components.

- Bob



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18 16:14                       ` Patrick
@ 2012-12-18 17:25                         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 22+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-18 17:25 UTC (permalink / raw)


On Tue, 18 Dec 2012 08:14:20 -0800 (PST), Patrick wrote:

> Yes we can make meta widgets in Ada-GTK but adding a lower level widget
> would likely involve C with Ada-GTK.

Not at all. C is not required for adding new widgets. You can create
composite widgets and, surprise, you can add new Ada proxies
(Gtk_XXX_Record types) to Gtk widgets missing in GtkAda without writing a
single line in C. For example, GtkAda contributions, which purpose is
largely mainly just this, does not have *any* C code.

> If all the widgets were coded in Ada
> and the primitives in the C/C++ core were nicely wrapped and isolated,
> then a new programmer could just learn Ada and not have to worry about
> C/C++.

Well, certainly it would be very nice to have 100% Ada cross-system
graphical framework. The problem is that Ada community is far too small to
accomplish such a Mammut task. Furthermore, there is no chance a firm would
develop it as commercial product. Because you cannot make any money selling
general-purpose libraries. This market was ruined decades ago.

> Again I have very limited experience with threading but I am
> guessing that if certain widgets were also protected, it would make
> writing a multi-threading GUI APP much nicer.

It is rather a long story. In short yes, Ada's tasking primitives could
help making GUI interfaces simpler. But there are many problems to solve,
like that task and protected types are not tagged, lack of multiple
inheritance to name few.

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



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

* Re: Ada Library, called, returns and continues ?
  2012-12-18  1:36                   ` Patrick
@ 2012-12-18 23:10                     ` Randy Brukardt
  0 siblings, 0 replies; 22+ messages in thread
From: Randy Brukardt @ 2012-12-18 23:10 UTC (permalink / raw)


"Patrick" <patrick@spellingbeewinnars.org> wrote in message 
news:7885cca5-2f08-48c1-ade1-9a5b10de932c@googlegroups.com...
> Your scaring me a bit. Do you think there is something fundamental about 
> Ada that makes it hard to create bindings or projects?

Good bindings are hard, for any language. Most bindings are not good for 
that reason.

> I am not saying I can do it, but I am thinking that porting 50K lines of 
> C++ to Ada should not be so hard, perhaps a month or two of full time 
> work.

I would guess that you are off by an order of magnitude, but of course it 
would depend on precisely what you are doing and how the existing code 
works.

Remember that the best way to do something in C++ is not necessarily the 
best way to do something in Ada (and vice-versa). For instance, C++ programs 
use altogether too many pointers (references) for good Ada. To make a really 
great Ada binding, you need to design it in Ada -- writing C-in-Ada does not 
buy much.

                                           Randy.





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

* Re: Ada Library, called, returns and continues ?
       [not found]                 ` <2nr1d89tvkc3h0dvcd62tpsf1vujsdb09o@invalid.netcom.com>
@ 2012-12-18 23:54                   ` Patrick
  0 siblings, 0 replies; 22+ messages in thread
From: Patrick @ 2012-12-18 23:54 UTC (permalink / raw)


Hi Dennis

It's actually available from abebooks for $8 including shipping:
http://www.abebooks.com/servlet/SearchResults?kn=The+Viewport+Technician%3A+A+Guide+to+Portable+Software+Design&sts=t

The book itself it $2 or so. I will definitely pick it up, thanks for the tip



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

end of thread, other threads:[~2012-12-18 23:54 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-16 19:21 Ada Library, called, returns and continues ? Patrick
2012-12-16 19:51 ` Simon Wright
2012-12-16 20:26 ` Dmitry A. Kazakov
2012-12-16 23:13   ` Patrick
2012-12-17  8:59     ` Dmitry A. Kazakov
2012-12-17 15:58       ` Patrick
2012-12-17 17:08         ` Simon Wright
2012-12-17 17:43           ` Patrick
2012-12-17 18:09         ` Dmitry A. Kazakov
2012-12-17 19:41           ` Patrick
2012-12-17 21:26             ` Dmitry A. Kazakov
2012-12-17 23:42               ` Patrick
2012-12-18  0:30                 ` Randy Brukardt
2012-12-18  1:36                   ` Patrick
2012-12-18 23:10                     ` Randy Brukardt
2012-12-18  9:17                 ` Dmitry A. Kazakov
2012-12-18 15:00                   ` Patrick
2012-12-18 15:37                     ` Dmitry A. Kazakov
2012-12-18 16:14                       ` Patrick
2012-12-18 17:25                         ` Dmitry A. Kazakov
2012-12-18 16:50                   ` Robert A Duff
     [not found]                 ` <2nr1d89tvkc3h0dvcd62tpsf1vujsdb09o@invalid.netcom.com>
2012-12-18 23:54                   ` Patrick

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