Interfacing Ada with C with Tcl/Tk... 
Author Message
 Interfacing Ada with C with Tcl/Tk...

Dear All,

I am writing a major software simulator in Ada. I also need to interface
this Ada code with C code (which I am able to do).

Additionally, I need to call various Tcl/Tk widgets from within the
Ada code. My way of thinking here is that my C code can interface with
the Tcl/Tk stuff, which in turn can be interfaced with my Ada code.

The Ada code needs to be able to determine the standard events,
such as clicking the mouse button when the cursor is in a
particular widget. For example, I'd like to have something like this
in my Ada code:

        declare
                widget1 : ENTRY_WIDGET;
                textvalue : string (1..30);
        .
        .
        DisplayWidget(widget1);
        .
        IF (MouseButtonClickedInWidget(widget1)) THEN
                GetTextFromWidget(textvalue, widget1);
        END IF;
        .
        .
        DestroyWidget(widget1);
        .

The code for 'DisplayWidget', 'MouseButtonClickedInWidget',
'GetTextFromWidget' and 'DestroyWidget' could be Ada
functions/procedures that invoke a corresponding C procedure, which
in turn interfaces with the appropriate Tcl/Tk widget.

However, I'm a bit uncertain as to whether or not I will have control over
the widgets from my Ada code, or whether most of the control (ie, of events)
will be handled and processed without the Ada code knowing about them.

I'll also need to impose various temp{*filter*}constraints on these events,
such as 'sequencing' (eg, enter text in one entry widget, then do the
same for another widget, etc); 'order independence' (letting the user
select any entry widget, but they must perform the text entry to
completion before starting another text entry task, etc). There are 3
other temp{*filter*}constraints that I need to implement.

Currently, I can cater for all 5 in my Ada software, but I need to
ensure that these temp{*filter*}constraints are carried over into the
Tcl/Tk environment. I assume that I can just implement 'grabs' to
achieve this.

Another issue that concerns me is whether or not I should pass widget
data structures between my Ada code and my C/Tcl/Tk code. For simplicity,
I would like to keep the Ada side as clean as possible. I thought maybe
I could define a record type that had 2 elements; 1) a simple (unique)
integer value to identify the relevant widget, and 2) a field that
contained an access type to the corresponding widget record pointer on
the C/Tk/Tcl side...???

Any thoughts will be greatly appreciated!!

--Steve

------------------------------------------------------------------------------

"...scalpel.....sutures.....clamp......oopps.....pen....death certificate...."

------------------------------------------------------------------------------



Tue, 02 Sep 1997 01:17:48 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Interfacing Ada with C with Tcl/Tk (Repost)

2. Interfacing Ada with C with Tcl/Tk (Repost)

3. Interfacing Ada with C with Tcl/Tk...

4. how to access prolog from tcl?(not using tcl/tk interface from prolog)

5. ANNOUNCE: Visual Ada Developer VAD 1.0 Tcl/Tk Ada Gui Builder Leonid Dulman

6. Data Interface with CS/3

7. Q: Ada-Tcl interfacing - does it work?

8. Q: Ada-Tcl interfacing - does it work?

9. Ada interface to Tcl

10. Ada interface to Tcl

11. non Tcl interfaces to Tk

12. Interface Cobol<->Tcl/Tk

 

 
Powered by phpBB® Forum Software