DEFINITION MODULE GKSWork;

(*
    Title: 	Graphical Kernel System Workstation Interface
    LastEdit:	"Tue Feb 26 14:37:34 1985"
    Author: 	jd
		Cambridge University Computer Laboratory
*)

(*  This module represents the GKS workstation abstraction. Its most important
    function is to clip shapes and transform them under the viewing
    transformation before sending them to the GKSDev interface.
*)

FROM SYSTEM IMPORT WORD;

FROM Vector IMPORT RVEC, RBOX;

FROM GKSTypes IMPORT
    WS, RBOXPOINTER, TRANSFORM, SEGMENT,
    ATTRTYPE, ATTRIBUTE, GDPCODE, ESCAPECODE;

EXPORT QUALIFIED
    OpenWS, CloseWS, ActivateWS, DeactivateWS, ClearWS, UpdateWS, 
    SetDeferralState, Message, Escape, 
    SetWSWindow, SetWSViewport, 
    SelectDisplay, DisplayLine, DisplayMarker,
    DisplayText, DisplayArea, DisplayPixels, DisplayGdp;


    (********** External Definitions For GKS Clients **********)

PROCEDURE OpenWS (type, instance: ARRAY OF CHAR): WS;
    (* NonStandard: a newly opened WS is active, not inactive *)

PROCEDURE CloseWS (ws: WS);
    (* NonStandard: the WS need not be inactive *)

PROCEDURE ActivateWS (ws: WS);

PROCEDURE DeactivateWS (ws: WS);

PROCEDURE ClearWS (ws: WS; obligatory: BOOLEAN);

PROCEDURE UpdateWS (ws: WS);

PROCEDURE SetDeferralState (ws: WS; AllowUpdateDeferral,
        AllowImplicitRedraw: BOOLEAN);

PROCEDURE Message (ws: WS; VAR s: ARRAY OF CHAR);

PROCEDURE Escape (ws: WS; function: ESCAPECODE; VAR w: WORD; 
        VAR a: ARRAY OF WORD);

PROCEDURE SetWSWindow (ws: WS; r: RBOX);

PROCEDURE SetWSViewport (ws: WS; r: RBOX);


    (********** Internal Definitions for GKS only **********)


PROCEDURE SelectDisplay (ws: WS; s: SEGMENT; R: RBOXPOINTER);
    (* for future DisplayXXX calls:
        ws is the workstation on which to display
        s is a segment (possibly NIL) whose transform should be composed
          with the workstation transformation.
        R is a clipping box in NDC space.
    *)

PROCEDURE DisplayLine (index, high: INTEGER; VAR points: ARRAY OF RVEC);

PROCEDURE DisplayMarker (index, high: INTEGER; VAR points: ARRAY OF RVEC);

PROCEDURE DisplayText (at: RVEC; index: INTEGER;
        char: ATTRIBUTE; VAR text: ARRAY OF CHAR);

PROCEDURE DisplayArea (index, high: INTEGER;
        patternref: ATTRIBUTE; VAR points: ARRAY OF RVEC);

PROCEDURE DisplayPixels (in: RBOX;
        RowHigh, ColumnHigh: INTEGER; VAR pixels: ARRAY OF CARDINAL);

PROCEDURE DisplayGdp (function: GDPCODE; arg: WORD;
        high: INTEGER; VAR points: ARRAY OF RVEC);


END GKSWork.
