%FOREIGN DEFINITION MODULE RGL;
(* 
   Interface with the Regis Fortran Subroutine package for
   the VT125. Not all the routines are defined; the additions
   should be trivial. The routine are not documented here. Please
   refer to the RGL reference manual.
                    Sohail Aslam CS Dept. 
*)

EXPORT QUALIFIED  
      Arc,
      Box,
      Circle,
      Clear_Area,
      Clear_Screen,
      Clear_Text,
      Clear_Viewport,
      Copy_Screen,
      Define_Color,
      Get_Location,
      Init_Graphics,
      Line,
      Load_CharSet,
      Locate,
      Move,
      PolyLine,
      Set_Color,
      Set_Degrees,
      Set_Italic,
      Set_LinePattern,
      Set_Radians,
      Set_TextAngle,
      Set_TextSize,
      Set_Viewport,
      Set_Window,
      Text;

PROCEDURE Arc(
    %REF     Angle : REAL; (* in *)
    %REF     X     : REAL; (* in *)
    %REF     Y     : REAL  (* in *)  );

PROCEDURE Box(
    %REF     Xlb   : REAL; (* in *)
    %REF     Ylb   : REAL; (* in *)
    %REF     Xrt   : REAL; (* in *)
    %REF     Yrt   : REAL  (* in *)  );

PROCEDURE Circle(
    %REF     Radius   : REAL (* in *) );
    (*
    Circle center will be at current cursor position.
    *)

PROCEDURE Clear_Area(
    %REF     Xlb   : REAL; (* in *)
    %REF     Ylb   : REAL; (* in *)
    %REF     Xrt   : REAL; (* in *)
    %REF     Yrt   : REAL  (* in *)  );
    (*
    Clears all graphics objects from the specified area.
    regular text is not cleared.
    *)

PROCEDURE Clear_Screen( );
    (*
    Clears all graphics objects on the screen.
    *)

PROCEDURE Clear_Text( );
    (*
    Clears normal terminal text from the screen.
    *)

PROCEDURE Clear_Viewport( );

PROCEDURE Copy_Screen( );

PROCEDURE Define_Color(
    %STDESCR Color : ARRAY OF CHAR; (* in*)
    %REF     Hue   : INTEGER;       (* in *)
    %REF   Light   : INTEGER;       (* in *)
    %REF Saturate  : INTEGER        (* in *) );
    (*
    Defines a color named "Color" with specified Hue, Lightness and 
    saturation. The limits are 0 <= hue <= 360, Light 0-100 and
    saturation 0-100.
    *)

PROCEDURE Get_Location(
    VAR %REF X  : REAL; (* out *)
    VAR %REF Y  : REAL  (* out *) );
    (*
    returns where the cursor is.
    *)

PROCEDURE Init_Graphics(
    %REF LUN  : INTEGER (* in *) );
    (*
    Must be called to initialize internal parameters.
    Don't call this routine with a constant. Assign the constant to variable
    and then pass the variable. e.g,
       lun := 5;
       RGL.Init_Graphics( lun );
    *)

PROCEDURE Line(
    %REF X  : REAL; (* in *)
    %REF Y  : REAL  (* in *) );
    (*
    Draw line to X,Y starting a current cursor position.
    *)

PROCEDURE Load_CharSet(
    %REF     Number   : INTEGER; (* in *)
    %STDESCR Filespec : ARRAY OF CHAR; (* in*)
    %REF     LUN      : INTEGER  (* in *) );
    (*
    Load character set from file "Filespec". Number can be 0-4.
    *)

PROCEDURE Locate(
    VAR %REF X    : REAL; (* out *)
    VAR %REF Y    : REAL; (* out *)
    VAR %REF Key  : CHAR  (* out *) );
    (*
    pick location with locator cursor. User signal by hitting a key
    which is returned, as a byte, in Key.
    *)

PROCEDURE Move(
    %REF X : REAL; (* in *)
    %REF Y : REAL  (* in *) );

PROCEDURE PolyLine(
    %REF Number : INTEGER; (* in *)
    %REF Xarray : ARRAY OF REAL; (* in *)
    %REF Yarray : ARRAY OF REAL  (* in *)  );
    (*
    Plot line throught x,y array. The cursor must have been moved to the
    first point.
    *)

PROCEDURE Set_Color(
    %STDESCR Color : ARRAY OF CHAR; (* in*)
    %REF  Number   : INTEGER        (* in *) );
    (*
    Associates the "Number" with the Color. Set_Color(' ', 2) enables
    color number 2 as the current drawing color. The color associated with
    color number 2 is not changed.
    *)

PROCEDURE Set_Degrees( );
    (*
    All angles interpreted in Degrees.
    *)

PROCEDURE Set_Italic(
    %REF Angle  : REAL (* in *) );
    (*
    actual slant can be -45, -27, 0, 27, 45 regardless of what "Angle" is.
    *)

PROCEDURE Set_LinePattern(
    %REF Number : INTEGER; (* in *)
    %REF Mult   : INTEGER  (* in *) );
    (*
    Both args can be 0-9.
    *)

PROCEDURE Set_Radians( );

PROCEDURE Set_TextAngle( 
    %REF Angle  : REAL     (* in *) );
    (*
    Angle can be in increments of 45 degrees.
    *)

PROCEDURE Set_TextSize(
    %REF Iwide  : INTEGER; (* in *)
    %REF Ihigh  : INTEGER  (* in *) );
    (*
    Both arg can range from 1-16.
    *)

PROCEDURE Set_Viewport(
    %REF Xmin : REAL; (* in *)
    %REF Xmax : REAL; (* in *)
    %REF Ymin : REAL; (* in *)
    %REF Ymax : REAL  (* in *) );
    (*
    Define portion of screen where the picture will be drawn.
    *)

PROCEDURE Set_Window(
    %REF Xleft : REAL; (* in *)
    %REF Ybot  : REAL; (* in *)
    %REF Xright: REAL; (* in *)
    %REF Ytop  : REAL  (* in *) );
    (*
    define world coordinates.
    *)

PROCEDURE Text(
    %STDESCR  Message : ARRAY OF CHAR (* in *) );
    (*
    Top justified text. Message must be <= 80 characters.
    *)

END RGL.
