DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦f91778603⟧ Ada Source

    Length: 39936 (0x9c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Main, seg_00535f

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Text_Io;
--/ if TeleGen2 and then Unix then
--// with Process_Control;                   -- Unix process control
--/ end if;

with Board;  
use Board;  
with Button;  
use Button;  
with Draw;  
use Draw;  
with Icon;  
use Icon;

with Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Basic;  
use Xlbt_Basic;  
with Xlbt_Cursor_Font;  
use Xlbt_Cursor_Font;  
with Xlbt_Event;  
use Xlbt_Event;  
with Xlbt_Gc;  
use Xlbt_Gc;  
with Xlbt_Hint;  
use Xlbt_Hint;  
with Xlbt_Geometry;  
use Xlbt_Geometry;  
with Xlbt_Key;  
use Xlbt_Key;  
with Xlbt_Misc;  
use Xlbt_Misc;  
with Xlbt_Pointer;  
use Xlbt_Pointer;  
with Xlbt_String;  
use Xlbt_String;  
with Xlbt_Window;  
use Xlbt_Window;

with Xlbp_Bitmap;  
use Xlbp_Bitmap;  
with Xlbp_Cursor;  
use Xlbp_Cursor;  
with Xlbp_Display;  
use Xlbp_Display;  
with Xlbp_Event;  
use Xlbp_Event;  
with Xlbp_Gc;  
use Xlbp_Gc;  
with Xlbp_Geometry;  
use Xlbp_Geometry;  
with Xlbp_Hint;  
use Xlbp_Hint;  
with Xlbp_Window;  
use Xlbp_Window;

package body Main is
------------------------------------------------------------------------------
-- Dragon - a version of Mah-Jongg for X Windows
--
-- Author: Gary E. Barnes        March 1989
--
-- main.c - The mainline code.
------------------------------------------------------------------------------
-- 05/30/90 GEB  - Translate to Ada
------------------------------------------------------------------------------

    Background_Width  : constant := 16;  
    Background_Height : constant := 16;  
    Background_X_Hot  : constant := -1;  
    Background_Y_Hot  : constant := -1;

    Background_Bits : constant U_Char_Array :=  
       (16#40#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#,  
        16#00#, 16#04#, 16#20#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#,  
        16#00#, 16#40#, 16#00#, 16#02#, 16#10#, 16#00#, 16#00#, 16#00#,  
        16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#01#, 16#08#, 16#00#);

    Gray_Width  : constant := 16;  
    Gray_Height : constant := 16;  
    Gray_X_Hot  : constant := -1;  
    Gray_Y_Hot  : constant := -1;

    Gray_Bits : constant U_Char_Array :=  
       (16#55#, 16#55#, 16#AA#, 16#AA#, 16#55#, 16#55#, 16#AA#, 16#AA#,  
        16#55#, 16#55#, 16#AA#, 16#AA#, 16#55#, 16#55#, 16#AA#, 16#AA#,  
        16#55#, 16#55#, 16#AA#, 16#AA#, 16#55#, 16#55#, 16#AA#, 16#AA#,  
        16#55#, 16#55#, 16#AA#, 16#AA#, 16#55#, 16#55#, 16#AA#, 16#AA#);

    Shadow_Width  : constant := 16;  
    Shadow_Height : constant := 16;  
    Shadow_X_Hot  : constant := -1;  
    Shadow_Y_Hot  : constant := -1;

    Shadow_Bits : constant U_Char_Array :=  
       (16#44#, 16#04#, 16#20#, 16#22#, 16#01#, 16#11#, 16#08#, 16#88#,  
        16#44#, 16#40#, 16#22#, 16#02#, 16#10#, 16#11#, 16#80#, 16#88#,  
        16#04#, 16#44#, 16#22#, 16#20#, 16#11#, 16#01#, 16#88#, 16#08#,  
        16#40#, 16#44#, 16#02#, 16#22#, 16#11#, 16#10#, 16#88#, 16#80#);

--\x0c
    ------------------------------------------------------------------------------
-- Dragon Resources
------------------------------------------------------------------------------

-- static s_long         def_DCTime      := 250; -- ms for double click
-- static boolean          def_FALSE       := false;
-- static boolean                def_TRUE        := True;
--
-- #define offset(field) XtOffset( Dragon_Resources_Ptr, field )
-- #define BOOLEAN(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_Boolean, sizeof(boolean), offset(field), Xlbt_Rm_Defs.Xt_R_Boolean, ,\
--      (X_Univ_Ptr)default}
-- #define CURSOR(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_Cursor, sizeof(Xlbt_Basic.X_Cursor), offset(field), ,\
--      Xlbt_Rm_Defs.Xt_R_String, (X_Univ_Ptr)default}
-- #define FONT(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_Font_Struct, sizeof(Xlbt_Font.X_Font_Struct*), offset(field), ,\
--      Xlbt_Rm_Defs.Xt_R_String, (X_Univ_Ptr)default}
-- #define INT(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_Int, sizeof(s_long), offset(field), Xlbt_Rm_Defs.Xt_R_Int, (X_Univ_Ptr)default}
-- #define PIXEL(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_Pixel, sizeof(Xlbt_Basic.X_Pixel), ,\
--      offset(field), Xlbt_Rm_Defs.Xt_R_String, (X_Univ_Ptr)default}
-- #define STRING(name,class,field,default) )\
--     {name, class, Xlbt_Rm_Defs.Xt_R_String, sizeof(String), offset(field), Xlbt_Rm_Defs.Xt_R_String, ,\
--      (X_Univ_Ptr)default}
--
-- static XtResource dragon_resources() := {
--   PIXEL  ( XtNbackground,   XtCBackground,   Background,
--     XtExtdefaultbackground ),
--   CURSOR ( "cursor",        XtCCursor,       Xlbt_Basic.X_Cursor,           "hand2"     ),
--   BOOLEAN( "debug",         "Debug",         Debug,               and def_FALSE  ),
--   INT    ( "doubleClick",   "DoubleClick",   Double_Click_Time,   and def_DCTime ),
--   PIXEL  ( XtNforeground,   XtCForeground,   Foreground,
--           XtExtdefaultforeground ),
--   STRING ( XtNgeometry,     XtCGeometry,     Xlbt_Rm.X_Rm_Geometry,                 "450x340"   ),
--   STRING ( "iconGeometry",  "IconGeometry",  Icon_Geometry,      "64x64"     ),
--   BOOLEAN( "iconic",        "Iconic",        Iconic,              and def_FALSE  ),
--   STRING ( XtNiconName,         XtCIconName,     Icon_Name,          null        ),
--   BOOLEAN( XtNreverseVideo, XtCReverseVideo, Reverse_Video,       and def_FALSE  ),
--   BOOLEAN( "stickyTile",    "StickyTile",    Sticky_Tile,     and def_TRUE   ),
--   BOOLEAN( "tileShadows",   "TileShadows",   Tile_Shadows,    and def_TRUE   ),
--   STRING ( "tileSides",         "TileSides",     Tile_Sides,         "gray"      ),
-- };

--\x0c
    ------------------------------------------------------------------------------
-- Dragon Command Line Options
------------------------------------------------------------------------------

-- static Xlbt_Rm2.X_Rm_Option_Desc command_line_options() := {
-- {"-cursor",      ".cursor",          Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)null  },
-- {"-debug",        ".debug",           Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"on"  },
-- {"-double",      ".doubleClick",     Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)null  },
-- {"-geometry",    ".geometry",        Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)null  },
-- {"-icongeometry",".iconGeometry",    Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)null  },
-- {"-iconic",      ".iconic",          Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"on"  },
-- {"+iconic",      ".iconic",          Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"off" },
-- {"-iconname",    ".iconName",        Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)null  },
-- {"-reverse",     "*reverseVideo",    Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"on"  },
-- {"+reverse",     "*reverseVideo",    Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"off" },
-- {"-shadows",     ".tileShadows",     Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"off"  },
-- {"+shadows",    ".tileShadows",     Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"on" },
-- {"-sides",        ".tileSides",       Xlbt_Rm.X_Rm_Option_Sep_Arg,  (X_Univ_Ptr)"line"},
-- {"-sticky",      ".stickyTile",      Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"off" },
-- {"+sticky",      ".stickyTile",      Xlbt_Rm.X_Rm_Option_No_Arg,   (X_Univ_Ptr)"on" },
-- };
--
-- typedef struct {
--   String    name;
--   String  desc;
-- } Option_Help;
--
-- static Option_Help command_line_help() := {
-- {"-help",                      "print out this message"},
-- {"-display displayname", "X server to contact"},
-- {"-cursor name",    "name of the cursor to use"},
-- {"-double time",  "double-click time limit in milliseconds"},
-- {"-font name",              "font to use for buttons and messages"},
-- {"-geometry WxH+X+Y",  "size (in pixels) and position of the board"},
-- {"-icongeometry WxH+X+Y","size (in pixels) and position of the program icon"},
-- {"-/+iconic",            "begin program as an icon"},
-- {"-iconname name",  "name to use with the program icon"},
-- {"-/+reverse",            "turn on/off reverse video"},
-- {"-/+shadows",            "turn on/off tile shadows"},
-- {"-sides line/black/gray","set the style for tile sides"},
-- {"-/+sticky",           "first tile selected sticky"},
-- { null, null }
-- };

--\x0c
    procedure Gc_Setup is
------------------------------------------------------------------------------
-- Set up the GC's that we will be using for drawing.
------------------------------------------------------------------------------
        Gcv : X_Gc_Values;  
        Pix : X_Pixel;  
    begin

----Xor_GC - fg = black, bg = white, func = xor; flops colors between the
--  foreground and the background when applied.

        Gcv.Funct      := Gx_Xor;  
        Gcv.Foreground := Dragon_Resources.Foreground xor  
                             Dragon_Resources.Background;  
        Gcv.Background := X_Pixel (0);  -- pixel value with all bits "off"
        Xor_Gc         :=  
           X_Create_Gc (Dpy,  
                        Dragon.Drawable,  
                        X_Gc_Components'  
                           (Gc_Function | Gc_Foreground | Gc_Background => True,  
                            others => False),  
                        Gcv);

----Normal_GC - fg = black, bg = white, func = copy

        Gcv.Funct      := Gx_Copy;  
        Gcv.Foreground := Dragon_Resources.Foreground;  
        Gcv.Background := Dragon_Resources.Background;  
        Normal_Gc      :=  
           X_Create_Gc (Dpy,  
                        Dragon.Drawable,  
                        X_Gc_Components'  
                           (Gc_Function | Gc_Foreground | Gc_Background => True,  
                            others => False),  
                        Gcv);

----Gray_GC - fg = black, bg = white, func = copy, tile = Gray

        Gcv.Tile := X_Create_Pixmap_From_Bitmap_Data  
                       (Dpy, Board.Drawable, Gray_Bits, Gray_Width,  
                        Gray_Height, Dragon_Resources.Foreground,  
                        Dragon_Resources.Background,  
                        X_Default_Depth (Dpy, X_Default_Screen (Dpy)));  
        if Gcv.Tile = None_X_Pixmap then  
            Text_Io.Put_Line ("Can't allocate gray pixmap.");  
            return;  
        end if;  
        Gcv.Fill_Style := Fill_Tiled;  
        Gray_Gc        :=  
           X_Create_Gc  
              (Dpy,  
               Dragon.Drawable,  
               X_Gc_Components'(Gc_Function | Gc_Foreground |  
                                Gc_Background | Gc_Tile | Gc_Fill_Style => True,  
                                others => False),  
               Gcv);

----Over_GC - fg = black xor white, bg = 0, func = copy

        Gcv.Funct   := Gx_Copy;  
        Gcv.Stipple :=               -- stipple operations are always depth 1
           X_Create_Bitmap_From_Data (Dpy, Board.Drawable, Shadow_Bits,  
                                      Shadow_Width, Shadow_Height);  
        if Gcv.Stipple = None_X_Pixmap then  
            Text_Io.Put_Line ("Can't allocate shadow pixmap.");  
            return;  
        end if;  
        Gcv.Fill_Style := Fill_Stippled;  
        Over_Gc        :=  
           X_Create_Gc  
              (Dpy, Dragon.Drawable,  
               X_Gc_Components'(Gc_Function | Gc_Foreground | Gc_Background |  
                                Gc_Stipple | Gc_Fill_Style => True,  
                                others                     => False),  
               Gcv);

----Reverse_GC - fg = white, bg = black, func = copy

        Gcv.Funct      := Gx_Copy;  
        Gcv.Background := Dragon_Resources.Foreground;  
        Gcv.Foreground := Dragon_Resources.Background;  
        Reverse_Gc     :=  
           X_Create_Gc (Dpy, Dragon.Drawable,  
                        X_Gc_Components'  
                           (Gc_Function | Gc_Foreground | Gc_Background => True,  
                            others => False),  
                        Gcv);

    end Gc_Setup;

--\x0c
    procedure Set_Size_Hints (Hints : in out X_Size_Hints;  
                              Geom  :        X_String) is
------------------------------------------------------------------------------
--  Hints   - Receives the X/Y/Width/Height values from the Geometry string
--  Geom    - Specifies the string specified by the user for the geometry
--
-- Parses the geometry string (if any) and takes care of setting the X/Y and
-- the Width/Height fields in the Hints structure.
------------------------------------------------------------------------------
        Geom_Result : X_Parse_Geometry_Flags;  
    begin

        Hints.X     := 0;  
        Hints.Y     := 0;  
        Geom_Result := None_X_Parse_Geometry_Flags;  
        if Geom /= "" then  
            X_Parse_Geometry (Geom,  
                              S_Short (Hints.X), S_Short (Hints.Y),  
                              U_Short (Hints.Width), U_Short (Hints.Height),  
                              Geom_Result);  
            if Geom_Result (Width_Value) and then  
               Geom_Result (Height_Value) then  
                Hints.Width            := Max (Hints.Width, Hints.Min_Width);  
                Hints.Height           := Max (Hints.Height, Hints.Min_Height);  
                Hints.Flags (U_S_Size) := True;  
            end if;  
            if Geom_Result (X_Value) and then  
               Geom_Result (Y_Value) then  
                Hints.Flags (U_S_Position) := True;  
            end if;  
        end if;  
        if not Hints.Flags (U_S_Size) then  
            Hints.Width          := Hints.Min_Width;  
            Hints.Height         := Hints.Min_Height;  
            Hints.Flags (P_Size) := True;  
        end if;  
        if not Hints.Flags (U_S_Position) then  
            Hints.X                  := 0;  
            Hints.Y                  := 0;  
            Hints.Flags (P_Position) := True;  
        end if;

        if Geom_Result (X_Negative) then  
            Hints.X := S_Long (X_Display_Width (Dpy, X_Default_Screen (Dpy))) +  
                          Hints.X - S_Long (Hints.Width);  
        end if;  
        if Geom_Result (Y_Negative) then  
            Hints.Y := S_Long (X_Display_Height (Dpy, X_Default_Screen (Dpy))) +  
                          Hints.Y - S_Long (Hints.Height);  
        end if;

    end Set_Size_Hints;

--\x0c
    procedure Main (Display : X_String) is
------------------------------------------------------------------------------
-- Our Main-Line Code.
------------------------------------------------------------------------------
        Error       : X_Error_String;  
        Class_Hint  : X_Class_Hint;  
        Size_Hints  : X_Size_Hints;  
        Wm_Hints    : X_Wm_Hints;  
        Attr        : X_Set_Window_Attributes;  
        Mask        : X_New_Window_Attributes := None_X_New_Window_Attributes;  
        Screen      : X_Screen_Number;  
        Event       : X_Event;  
        Success     : X_Status;  
        Icon_Window : X_Window                := None_X_Window;  
        Env         : constant X_String       :=  
           X_Display_Name (Display);  
    begin

----Start up the toolkit.  This creates a shell widget.  Unfortunately the
--  only way the toolkit allows you to specify default application resources
--  is by having a /usr/lib/X11/app-defaults/Application resouce file.  I'm
--  not interested in doing this.  If some site wants to create one in order
--  to customize the program then that is fine.  However, I want my program
--  to be "standalone"; ie. if you have the binary executable then you have
--  all you *must-have*.  So, I will Destroy this widget shortly.

        X_Open_Display (Env, Dpy, Error);  
        if Dpy = null then  
            Text_Io.Put_Line ("Unable to open display {" & To_String (Display) &  
                              "}: " & To_String (Err (Error)));  
            raise Abandon;  
        end if;

        Screen := X_Default_Screen (Dpy);

----Initialize the resources.  Do it this way until we have real widgets.

        Dragon_Resources.Background    := X_White_Pixel (Dpy, Screen);  
        Dragon_Resources.Cursor        := X_Create_Font_Cursor (Dpy, Xc_Hand2);  
        Dragon_Resources.Debug         := False;  
        Dragon_Resources.Double_Click  := 250;  
        Dragon_Resources.Foreground    := X_Black_Pixel (Dpy, Screen);  
        Dragon_Resources.Geometry      := new X_String'("450x340");  
        Dragon_Resources.Icon_Geometry := new X_String'("64x64");  
        Dragon_Resources.Iconic        := False;  
        Dragon_Resources.Icon_Name     := null;  
        Dragon_Resources.Reverse_Video := False;  
        Dragon_Resources.Sticky_Tile   := True;  
        Dragon_Resources.Tile_Shadows  := True;  
        Dragon_Resources.Tile_Sides    := new X_String'("gray");


----Set up the various Hints structures for our main window.

        Size_Hints.Min_Width    := 450;  
        Size_Hints.Min_Height   := 340;  
        Size_Hints.Base_Width   := 450;  
        Size_Hints.Base_Height  := 340;  
        Size_Hints.Width_Inc    := 210;  
        Size_Hints.Height_Inc   := 160;  
        Size_Hints.Min_Aspect.X := 1333;  
        Size_Hints.Min_Aspect.Y := 1000;  
        Size_Hints.Max_Aspect.X := 1333;  
        Size_Hints.Max_Aspect.Y := 1000;  
        Size_Hints.Flags        :=  
           X_Size_Hints_Flags'  
              (P_Min_Size | P_Aspect | P_Resize_Inc | P_Base_Size => True,  
               others => False);  
        Set_Size_Hints (Size_Hints, Dragon_Resources.Geometry.all);

        Wm_Hints.Input := True;  
        Wm_Hints.Flags := X_Wm_Hints_Flags'(Input_Hint => True,  
                                            others     => False);

        Class_Hint.Res_Name  := new X_String'("dragon");  
        Class_Hint.Res_Class := new X_String'("Dragon");

        Attr.Background_Pixel := Dragon_Resources.Background;  
        Attr.Border_Pixel     := Dragon_Resources.Foreground;  
        Attr.Cursor           := X_Create_Font_Cursor (Dpy, Xc_Hand2);

        Mask := X_New_Window_Attributes'  
                   (Cw_Background_Pixel | Cw_Border_Pixel | Cw_Cursor => True,  
                    others => False);
----Set up our icon.

        Icon_Setup (Wm_Hints);  
        if Wm_Hints.Flags (Icon_Window_Hint) then  
            Icon_Window := Wm_Hints.Icon_Window;  
        end if;

----Create our main window.

        Dragon := X_Create_Window  
                     (Dpy, X_Default_Root_Window (Dpy),  
                      S_Short (Size_Hints.X), S_Short (Size_Hints.Y),  
                      U_Short (Size_Hints.Width), U_Short (Size_Hints.Height),  
                      2, X_Default_Depth (Dpy, Screen),  
                      Input_Output, X_Default_Visual_Of_Screen  
                                       (X_Default_Screen_Of_Display (Dpy)),  
                      Mask, Attr);  
        Board  := Dragon;

        X_Set_Wm_Properties (Dpy, Dragon, "Dragon", "Dragon",  
                             (1 .. 0 => None_X_String_Pointer),  
                             Size_Hints, Wm_Hints, Class_Hint, Success);

----Check the tile controls.

        Tile_Control := 0;  
        if Dragon_Resources.Tile_Shadows then  
            Tile_Control := Tile_Control or Shadow;  
        end if;  
        if Dragon_Resources.Tile_Sides.all = "black" then  
            Tile_Control := Tile_Control or Blackside;  
        elsif Dragon_Resources.Tile_Sides.all = "gray" then  
            Tile_Control := Tile_Control or Blackside or Grayside;  
        elsif Dragon_Resources.Tile_Sides.all /= "line" then  
            Text_Io.Put_Line  
              ("-side option not given line, gray, or black value.");  
        end if;

----Create the board that we will be using; realize it too.

        Board_Setup;  
        X_Select_Input  
           (Dpy, Dragon,  
            X_Event_Mask'(Structure_Notify_Mask | Exposure_Mask |  
                          Button_Release_Mask | Button_Press_Mask => True,  
                          others => False));  
        X_Map_Window (Dpy, Dragon);

----Set up our GC's.

        Gc_Setup;

----Now make it all appear in front of the user.

        declare  
            Pix : X_Pixmap;  
        begin  
            Pix := X_Create_Pixmap_From_Bitmap_Data  
                      (Dpy, Dragon.Drawable, Background_Bits,  
                       Background_Width, Background_Height,  
                       Dragon_Resources.Foreground, Dragon_Resources.Background,  
                       X_Default_Depth (Dpy, X_Default_Screen (Dpy)));

            if Pix = None_X_Pixmap then  
                Text_Io.Put_Line ("Can't allocate background pixmap.");  
                raise Abandon;  
            end if;  
            X_Set_Window_Background_Pixmap (Dpy, Board, Pix);  
        end;

----Now do the real thing.

        loop  
            X_Next_Event (Dpy, Event);

            if Event.Window = Dragon then  
                case Event.Kind is  
                    when Expose =>  
                        Button_Expose;  
                        Board_Expose;  
                    when Configure_Notify =>  
                        Board_Configure (Event);  
                    when Xlbt_Event.Button_Press =>  
                        if Event.Button.State /= None_X_Key_Button_Mask then  
                            null;   -- No Meta/Shift/Control keys allowed.
                        elsif Event.Button.Button = Button_1 then  
                            Button.Button_Press (Event);  
                            Tile_Press (Event);  
                        elsif Event.Button.Button = Button_2 then  
                            Hints (Event);  
                        elsif Event.Button.Button = Button_3 then  
                            Tile_Remove (Event);  
                        end if;  
                    when Xlbt_Event.Button_Release =>  
                        if Event.Button.Button = Button_1 then  
                            Button.Button_Release (Event);  
                            Tile_Release (Event);  
                        end if;  
                    when others =>  
                        null;  
                end case;  
            elsif Event.Window = Icon_Window then  
                if Event.Kind = Expose then  
                    Icon_Expose (Icon_Window, Event);  
                end if;  
            else  
                Text_Io.Put ("Event for window 0x");  
                S_Long_Io.Put  
                   (Event.Window.Drawable.Id.Number, Base => 16, Width => 0);  
                Text_Io.Put (" kind: ");  
                Text_Io.Put (X_Event_Code'Image (Event.Kind));  
                Text_Io.New_Line;  
            end if;  
        end loop;

    exception

----Differing forms of program termination.

        when Abandon =>
--/ if TeleGen2 and then Unix then
--//             Process_Control.Exit_Execution (1);
--/ end if;
            raise;

        when Quit =>
--/ if TeleGen2 and then Unix then
--//             Process_Control.Exit_Execution (0);
--/ end if;
            null;

    end Main;

end Main;  

E3 Meta Data

    nblk1=26
    nid=0
    hdr6=4c
        [0x00] rec0=34 rec1=00 rec2=01 rec3=008
        [0x01] rec0=1a rec1=00 rec2=02 rec3=018
        [0x02] rec0=00 rec1=00 rec2=26 rec3=006
        [0x03] rec0=16 rec1=00 rec2=03 rec3=01c
        [0x04] rec0=00 rec1=00 rec2=25 rec3=00c
        [0x05] rec0=13 rec1=00 rec2=04 rec3=076
        [0x06] rec0=10 rec1=00 rec2=05 rec3=030
        [0x07] rec0=0f rec1=00 rec2=06 rec3=03c
        [0x08] rec0=0d rec1=00 rec2=07 rec3=03a
        [0x09] rec0=13 rec1=00 rec2=08 rec3=02e
        [0x0a] rec0=17 rec1=00 rec2=09 rec3=03a
        [0x0b] rec0=00 rec1=00 rec2=24 rec3=00a
        [0x0c] rec0=16 rec1=00 rec2=0a rec3=04a
        [0x0d] rec0=01 rec1=00 rec2=23 rec3=00a
        [0x0e] rec0=17 rec1=00 rec2=0b rec3=054
        [0x0f] rec0=00 rec1=00 rec2=22 rec3=00e
        [0x10] rec0=17 rec1=00 rec2=0c rec3=038
        [0x11] rec0=00 rec1=00 rec2=21 rec3=01c
        [0x12] rec0=18 rec1=00 rec2=0d rec3=00a
        [0x13] rec0=00 rec1=00 rec2=20 rec3=010
        [0x14] rec0=14 rec1=00 rec2=0e rec3=032
        [0x15] rec0=01 rec1=00 rec2=1f rec3=012
        [0x16] rec0=19 rec1=00 rec2=0f rec3=014
        [0x17] rec0=01 rec1=00 rec2=1d rec3=008
        [0x18] rec0=12 rec1=00 rec2=1e rec3=062
        [0x19] rec0=03 rec1=00 rec2=10 rec3=002
        [0x1a] rec0=14 rec1=00 rec2=11 rec3=024
        [0x1b] rec0=01 rec1=00 rec2=1c rec3=00c
        [0x1c] rec0=18 rec1=00 rec2=12 rec3=02a
        [0x1d] rec0=00 rec1=00 rec2=1b rec3=030
        [0x1e] rec0=19 rec1=00 rec2=13 rec3=01e
        [0x1f] rec0=00 rec1=00 rec2=1a rec3=01e
        [0x20] rec0=16 rec1=00 rec2=14 rec3=01a
        [0x21] rec0=00 rec1=00 rec2=19 rec3=002
        [0x22] rec0=1c rec1=00 rec2=15 rec3=03c
        [0x23] rec0=18 rec1=00 rec2=16 rec3=046
        [0x24] rec0=15 rec1=00 rec2=17 rec3=056
        [0x25] rec0=1a rec1=00 rec2=18 rec3=001
    tail 0x215009ba88197878e28cf 0x42a00088462063203