comp.lang.ada
 help / color / mirror / Atom feed
* Ada / Motif Binding Question
@ 2002-04-23 22:56 Tony Yu
  2002-04-24  2:19 ` Ted Dennison
  2002-04-26  2:25 ` Greg Bek
  0 siblings, 2 replies; 6+ messages in thread
From: Tony Yu @ 2002-04-23 22:56 UTC (permalink / raw)


Hi,
    I recently started using the Motif binding with Ada and had great
difficulty getting the callback functions to work properly.  The following
is a small program I created:

----------------------------------------------------------------------------
--------------------------
with X_Support.Xt, X_Support.Lib, X_Support.Xm, X_Support.Xm_Defs,
Ada.Text_Io;

with X_Support.Form, X_Support.Push_Button;



procedure My_Test is

    Appshell : X_Support.Xt.Widget := X_Support.Xt.Null_Widget;

    App_Con : X_Support.Xt.Xt_App_Context;

    Form, Exitbutton : X_Support.Xt.Widget;

    Argc : Natural := 0;

    Argv : X_Support.Xt.Argv_Type;

    procedure My_Proc is

        begin

            Ada.Text_Io.Put_Line ("Hello!");

        end My_Proc;

    procedure Exit_Option (W : X_Support.Xt.Widget;

        Client_Data : X_Support.Xt.Xt_Pointer;

        Call_Data : X_Support.Xt.Xt_Pointer) is

        My_String : String (1 .. 625) := (others => ' ');

        procedure C_Exit (Status : Integer);

        pragma Import (C, C_Exit, External_Name => "exit");

        begin

            C_Exit (0);

        end Exit_Option;

begin

    X_Support.Xt.Xt_Initializers.Xt_App_Initialize

        (App_Context_Return => App_Con,

        Application_Class => "",

        Argc_In_Out => Argc,

        Argv_In_Out => Argv,

        Widget_Id => Appshell);

        Form := X_Support.Xt.Xt_Instance_Management.Xt_Create_Managed_Widget

        ("form", X_Support.Form.Xm_Form_Widget_Class, Appshell);

        Exitbutton :=

            X_Support.Xt.Xt_Instance_Management.Xt_Create_Managed_Widget

                (Name => "EXIT",

                Of_Class => X_Support.Push_Button.

                Xm_Push_Button_Widget_Class,

                Parent => Form);

        X_Support.Xt.Xt_Callbacks.Xt_Add_Callback

            (Exitbutton, X_Support.Xm_Defs.Nactivatecallback,

            Exit_Option'Address, X_Support.Xt.Null_Xt_Pointer);

        X_Support.Xt.Xt_Instance_Management.Xt_Realize_Widget (Appshell);

        X_Support.Xt.Xt_Event_Management.Xt_App_Main_Loop (App_Con);

end My_Test;

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

After invoking the callback, I get the following error:

 -> ** MAIN PROGRAM ABANDONED -- EXCEPTION "STORAGE_ERROR" RAISED

If I suppress the Storage_Error check, I get the following:

-> exception_handler: below bottom of user stack



I suspect that the callback procedure is not being allocated enough stack
space for me to declare such a string.  I've had similar exceptions when I
perform a Text_Io, or call another procedure/function within the callback
procedure.  Oh, I compiled this program using Rational Apex 3.2.0b.  Is
there a way to increase the stack size allocated to the callback procedure?
Any help would be appreciated!  Thanks in advance!

-Tony Yu

P.S.  I appologise if this topic has been mentioned before.






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

end of thread, other threads:[~2002-04-29 22:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 22:56 Ada / Motif Binding Question Tony Yu
2002-04-24  2:19 ` Ted Dennison
2002-04-24  3:08   ` Tony Yu
2002-04-26  6:28     ` Christopher Green
2002-04-29 22:55       ` Tony Yu
2002-04-26  2:25 ` Greg Bek

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