------------------------------------------------------------------------------ -- -- -- XVIEW ADA LIBRARY COMPONENTS -- -- -- -- XVIEW_TTYSW_PACKAGE -- -- -- -- B o d y -- -- -- -- Copyright (c) 1995 Andreas Almroth, All Rights Reserved -- -- -- -- The XVIEW ADA library is free software; you can redistribute it and/or -- -- modify it under terms of the GNU Library General Public License as -- -- published by the Free Software Foundation; either version 2, or (at your -- -- option) any later version. The XVIEW ADA library is distributed in the -- -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the -- -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- -- License along with the XVIEW ADA library; see the file COPYING.LIB. If -- -- not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, -- -- MA 02139, USA. -- -- -- ------------------------------------------------------------------------------ -- Lots of bindings to XView C functions needs the Interfaces.C package. with Interfaces.C,Interfaces.C.Strings; package body Xv_Ttysw_Package is XV_SHOW : constant := 1079052545; XV_WIDTH : constant := 1246234689; XV_HEIGHT : constant := 1246300289; XV_X : constant := 1246103617; XV_Y : constant := 1246169217; WIN_ROWS : constant := 1232603137; WIN_COLUMNS : constant := 1225525249; ----------------------------------------------------------------------------- function xv_set (owner : Xv_opaque; cmd : Integer; data : Integer; term : Integer) return Xv_object; pragma import (C,xv_set,"xv_set"); -- function xv_set (owner : Xv_opaque; cmd : Integer; -- data2 : Interfaces.C.char_array; -- Data3 : Integer; term : Integer) return Xv_object; -- pragma import (C,xv_set,"xv_set"); ----------------------------------------------------------------------------- procedure xv_destroy_safe (object : Xv_Opaque); pragma import (C,xv_destroy_safe,"xv_destroy_safe"); ----------------------------------------------------------------------------- -- function xv_get (owner : Xv_opaque; cmd : Integer; term : Integer) -- return Integer; -- pragma import (C,xv_get,"xv_get"); -- function xv_get (owner : Xv_opaque; cmd : Integer; -- Data1 : Integer; -- Data2 : Interfaces.C.Char_Array; Len : Integer; -- term : Integer) -- return Integer; -- pragma import (C,xv_get,"xv_get"); ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- xv_Ttysw ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- procedure Initialize (V : in out Xv_Ttysw) is -- Declare C binding for xv_create function Xv_Create (Owner : Frame; Pkg : Xv_Pkg_Ptr; Cmd1 : Integer; Rows : Integer; Cmd2 : Integer; Cols : Integer; Term : Integer) return Ttysw; pragma Import (C,Xv_Create,"xv_create"); -- Initialize panel_base pointer Xv_Tty_Pkg : Xv_Pkg_Ptr; pragma Import (C,Xv_Tty_pkg,"my_xv_tty_pkg"); begin V.Base := Xv_Create(V.Parent,Xv_Tty_pkg,WIN_ROWS,V.Rows, WIN_COLUMNS,V.Columns,0); end Initialize; ----------------------------------------------------------------------------- procedure Finalize (V : in out Xv_Ttysw) is begin Xv_Destroy_Safe(Xv_Opaque(V.Base)); end Finalize; ----------------------------------------------------------------------------- procedure Set_Pos (V : in Xv_Ttysw; X,Y : Integer) is Xv_Rc : Xv_Object; begin Xv_Rc := Xv_Set(Xv_Opaque(V.Base),XV_X,X,0); Xv_Rc := Xv_Set(Xv_Opaque(V.Base),XV_Y,Y,0); end Set_Pos; ----------------------------------------------------------------------------- procedure Set_Size (V : in Xv_Ttysw; W,H : Integer) is Xv_Rc : Xv_Object; begin Xv_Rc := Xv_Set(Xv_Opaque(V.base),XV_WIDTH,W,0); Xv_Rc := Xv_Set(Xv_Opaque(V.base),XV_HEIGHT,H,0); end Set_Size; ----------------------------------------------------------------------------- function Input (V : in Xv_Ttysw; Cmd : String) return Integer is function Ttysw_Input (Obj : Ttysw; Cmd : Interfaces.C.Char_Array; Len : Integer) return Integer; pragma Import (C,Ttysw_Input,"ttysw_input"); begin return Ttysw_Input(Get_Ttysw(V),Interfaces.C.To_C(Cmd,True), Cmd'Last); end Input; ----------------------------------------------------------------------------- function Output (V : in Xv_Ttysw; Cmd : String) return Integer is function Ttysw_Output (Obj : Ttysw; Cmd : Interfaces.C.Char_Array; Len : Integer) return Integer; pragma Import (C,Ttysw_Output,"ttysw_output"); begin return Ttysw_Output(Get_Ttysw(V),Interfaces.C.To_C(Cmd,True), Cmd'Last); end Output; ----------------------------------------------------------------------------- function Get_Ttysw (V : in Xv_Ttysw) return Ttysw is begin return V.Base; end Get_Ttysw; end Xv_Ttysw_Package;