(****************************************************************************) (* *) (* GSX Main Module *) (* =============== *) (* This Module contains all managing GSX functions, including the basic *) (* variable definitions used in the whole GSX system. *) (* *) (* 21.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXMAIN; FROM SYSTEM IMPORT ADDRESS; TYPE VECTOR = RECORD (* Used to specify a pixel position in arrays. *) X,Y : CARDINAL END; CONST CRT = 1; PLOTTER = 11; PRINTER = 21; (* Some predefined workstation identifiers. *) replace = 1; transparent = 2; (* Usable draw modes. *) xor = 3; erase = 4; PinLen = 4; PoutLen = 4; (* Size of default GSX arrays *) CinLen = 128; CoutLen = 128; (* may be altered by user *) VAR PB : RECORD (* Graphic Parameter Block used by GSX. *) CTRLADD : ADDRESS; CINADD : ADDRESS; PINADD : ADDRESS; COUTADD : ADDRESS; POUTADD : ADDRESS; END; CB : RECORD (* Control Block used by GSX. *) OPCODE : CARDINAL; (* Main function identifier. *) PINLEN : CARDINAL; (* Number of parameters for all arrays. *) POUTLEN : CARDINAL; CINLEN : CARDINAL; COUTLEN : CARDINAL; ESCID : CARDINAL; (* Second function identifier. *) CTRL7 : CARDINAL; (* Opcode dependent information. *) CTRL8 : CARDINAL; CTRL9 : CARDINAL; CTRL10 : CARDINAL; END; OpenParas : ARRAY[1..10] OF CARDINAL; (* default open workstation parameters *) OpenCards : ARRAY[1..45] OF CARDINAL; (* CARDINAL information about workstation *) OpenPtrs : ARRAY[1..6 ] OF VECTOR; (* VECTOR information about workstation *) ColorExamined : RECORD (* Returned information from ExamineColor. *) Index, Red, Green, Blue : CARDINAL END; PTSIN : ARRAY [1..PinLen] OF VECTOR; (* input vectors *) PTSOUT : ARRAY [1..PoutLen] OF VECTOR; (* output vectors *) CARDIN : ARRAY [1..CinLen] OF CARDINAL; (* input cardinals *) CARDOUT : ARRAY [1..CoutLen] OF CARDINAL; (* output cardinals *) PROCEDURE ResetAddr; (* internal use only *) PROCEDURE ResetPara; (* internal use only *) PROCEDURE simple ( Opcode : CARDINAL ); (* internal use only *) PROCEDURE simplESC ( Opcode : CARDINAL ); (* internal use only *) PROCEDURE oneCARD ( Opcode, Para : CARDINAL ); (* internal use only *) PROCEDURE SetText ( Text : ARRAY OF CHAR ); (* internal use only *) PROCEDURE numPTS ( Opcode, Number : CARDINAL; VAR Points : ARRAY OF VECTOR ); (************************************************************************************) (* G S X M A I N Definitions *) (* ============================== *) PROCEDURE OpenStation ( Identifier : CARDINAL ); (* Opens the passed workstation. MUST be used before accessing other GSX procedures. *) PROCEDURE CloseStation; (* Counterpart to OpenStation. MUST be called prior to returning to operating system or open another workstation. *) PROCEDURE ClearStation; (* Erase screens , insert blank paper. After OpenStation, this procedure ist not needed. *) PROCEDURE UpdateStation; (* Causes all pending commands to be executed. Before closing a workstation, this procedure is not needed. Mainly used for printer drivers. *) PROCEDURE GraphMode; (* Explicitly sets graphic mode. Clear screens. After OpenStation, the device is already in graphic mode. *) PROCEDURE TextMode; (* Turns to cursor-addressable text mode. This function is also performed by CloseStation. *) PROCEDURE HardCopy; (* Dumps out screen contents on printer. Only meaningfull if the device is a CRT. *) PROCEDURE SetCursor ( X,Y : CARDINAL ); (* Display the graphic cursor ( usualy a cross ) at the specified position. Any old cursor is removed, so you don't need to use the RemoveCursor procedure unless you want to display no cursor at all. Only meaningfull if the device is a CRT. *) PROCEDURE RemoveCursor; (* Removes a previously displayed graphic cursor. If no cursor was displayed, nothing happens. *) PROCEDURE DefineColor ( Index, Red, Green, Blue : CARDINAL ); (* Defines color palette for this color index. If the index is not available, nothing happens. *) PROCEDURE ExamineColor ( Index : CARDINAL; Realized : BOOLEAN ); (* Examines color palette for this color index. If Realized = TRUE, color displayed on device is returned, else color defined with DefineColor or OpenStation is returned in ColorExamined. If the index is out of range, then the maximum index is returned ( the same would be used if you try to DRAW with this out-of-range index ). *) PROCEDURE DrawMode ( Mode : CARDINAL ); (* Determines the way pixels are modified. Not all devices can do drawing in all modes ( for example, a PLOTTER can't do xor drawing). Default DrawMode is replace. *) END GSXMAIN. (****************************************************************************) (* *) (* GSX Array Module *) (* ================ *) (* This Module contains GSX functions to read and write cell arrays. Note *) (* these functions require zooming and access to screen memory and there- *) (* fore, they are not implemented in most device drivers. Also, you need a *) (* full CARDINAL to store the color index for one pixel ... *) (* *) (* 21.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXARRAY; PROCEDURE DisplayCell ( ); (* See above ... *) PROCEDURE InquireCell ( ); (* See above ... *) END GSXARRAY. (****************************************************************************) (* *) (* GSX Char Module *) (* =============== *) (* This Module contains all text-related GSX functions, which provice a *) (* device-independent access to normal text screens. In future, this module *) (* will be enhanced by a text window manager. *) (* *) (* 20.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXCHAR; VAR Rows, Columns : CARDINAL; (* screen dimensions X,Y *) PROCEDURE GetDimensions; (* A call to GetDimensions returns the number of addressable rows & columns on the screen. If access to specific rows/columns is not possible, this values are set to MAX ( CARDINAL ) *) PROCEDURE CursorUp; (* Advances text cursor 1 row up. If the cursor was already on top of screen, nothing happens. *) PROCEDURE CursorDown; (* Advances text cursor 1 row down. If the cursor was already on bottom of screens, nothing happens. *) PROCEDURE CursorRight; (* Advances text cursor 1 column right. If the cursor was already on rightmost column of screen, nothing happens. *) PROCEDURE CursorLeft; (* Advances text cursor 1 column left. If the cursor was already on leftmost column of screen, nothing happens. *) PROCEDURE CursorHome; (* Force text cursor to home position : top left of screen. *) PROCEDURE EraseLineEnd; (* Erase current line from text cursor position to end of line. The new cursor position is undetermined and must be set by CursorAt. *) PROCEDURE EraseScreenEnd; (* Erase screen from text cursor position to end of screen. The new cursor position is undetermined and must be set by CursorAt. *) PROCEDURE CursorAt ( Row, Column : CARDINAL ); (* Sets text cursor to specified position. Valid range for Row/Column is [1..Rows/Columns]. If Row/Column are out of range, cursor positon is trunced to allowed range. *) PROCEDURE WriteText ( Text : ARRAY OF CHAR ); (* Writes a text string at cursor position. The cursor position advances with each displayed character until rightmost column is reached. If there are more characters in Text, they are ignored. Note that the length of Text is trunced to CinLen ( see GSXMAIN.DEF ), if nessessary. *) PROCEDURE Reverse; (* Switch to inverse text. *) PROCEDURE Normal; (* Switch back to normal text ( default ) *) PROCEDURE GetPosition ( VAR Row, Column : CARDINAL ); (* Returns current cursor position. *) END GSXCHAR. (****************************************************************************) (* *) (* GSX Fill Module *) (* =============== *) (* This Module contains all area-related GSX functions, including some GDPs *) (* which provide fast drawing of often used graphic objects. *) (* *) (* 21.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXFILL; FROM GSXMAIN IMPORT VECTOR; CONST hollow = 0; solid = 1; (* Available fill styles *) pattern = 2; hatch = 3; lines90 = 1; lines0 = 2; (* Available fill hatch styles *) lines45 = 3; lines135 = 4; cross = 5; xxx = 6; PROCEDURE FillPolygon ( Number : CARDINAL; VAR Points : ARRAY OF VECTOR ); (* Draw a polygon with Number points. *) PROCEDURE FillBar ( X, Y , dX, dY : CARDINAL ); (* Draw a bar with left lower egde at X, Y and width = dX, height = dY. *) PROCEDURE FillPie ( X, Y, Radius, Startangle, Endangle : CARDINAL ); (* Draw a pie with center point at X, Y and given Radius. Angles are [0..3600], and Startangle <= Endangle . *) PROCEDURE FillCircle ( X, Y, Radius : CARDINAL ); (* Draw a circle with center point at X, Y and given Radius. *) PROCEDURE FillStyle ( Style : CARDINAL ); (* Sets fill style. hollow is only outline, solid and pattern do what they mean, each pattern index is darker than index-1 , hatch generates the styles listed above. *) PROCEDURE FillIndex ( Index : CARDINAL ); (* If Style = pattern, Index [1..6] generates a pattern, if Style = hatch, the same Index [lines90..xxx] generates a hatch style. *) PROCEDURE FillColor ( Color : CARDINAL ); (* Set Color index for all fill operations. *) END GSXFILL. (****************************************************************************) (* *) (* GSX Input Module *) (* ================ *) (* This Module contains all GSX input functions. Input is available from *) (* CRT and (maybe) PLOTTER devices. Not all functions may be implemented. *) (* *) (* 26.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXIN; CONST Keyboard = 1; Mouse = 2; (* Predefined Input Locator Devices *) locator = 1; valuator = 2; (* Constants for changing input modes *) choice = 3; string = 4; request = 1; sample = 2; (* Available input modes *) VAR CursorX, CursorY : CARDINAL; (* Actual cursor ( locator ) position *) Value : CARDINAL; (* Actual valuator position *) PROCEDURE Tablet ( ) : BOOLEAN; (* Returns TRUE if a graphic input, like a mouse, joystick, lightpen etc, is connected to this device. If Tablet is TRUE you can access the locator with Device = Mouse, else you have to use the Device Keyboard. *) PROCEDURE Locator ( Device : CARDINAL; (* Access Device, gets a coordinate and/or a *) VAR C : CHAR; (* terminator, and report this action. *) VAR Moved, Terminated : BOOLEAN ); PROCEDURE Valuator ( VAR C : CHAR; (* Simulates a variable resistor. May be used to *) VAR Changed, (* regulate analog functions like intensities. *) Terminated : BOOLEAN ); PROCEDURE Choice ( Device : CARDINAL; (* Request function keys, get a key number or *) VAR N : CARDINAL; (* a nonchoice character. *) VAR C : CHAR; VAR Choiced, Terminated : BOOLEAN ); PROCEDURE String ( Device : CARDINAL; (* Request input of string, echo string on screen *) Echo : BOOLEAN; (* if desired. *) X,Y : CARDINAL; VAR Text : ARRAY OF CHAR; VAR Done : BOOLEAN ); PROCEDURE InputMode ( Device, Mode : CARDINAL ); (* Sets Device to request or sample. *) END GSXIN. (****************************************************************************) (* *) (* GSX Line Module *) (* =============== *) (* This Module contains all procedures to draw lines and set their attri- *) (* butes. *) (* *) (* 26.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXLINE; FROM GSXMAIN IMPORT VECTOR; CONST solid = 1; dash = 2; (* Available linetypes *) dot = 3; dashdot = 4; longdash = 5; PROCEDURE PolyLine ( Number : CARDINAL; VAR Points : ARRAY OF VECTOR ); (* Draw a polyline with selected type, width and color. *) PROCEDURE DrawArc ( X, Y, Radius, Startangle, Endangle : CARDINAL ); (* Draw an arc with center point X, Y and Radius. Angles in [0..3600], Startangle <= Endangle.*) PROCEDURE LineType ( Type : CARDINAL ); (* Sets linetypes defined above *) PROCEDURE LineWidth ( Width : CARDINAL ); (* Tries to change line width. Most devices don't support this. *) PROCEDURE LineColor ( Color : CARDINAL ); (* Sets a color index for lines and arcs. *) END GSXLINE. (****************************************************************************) (* *) (* GSX Marker Module *) (* ================= *) (* This Module contains GSX functions to display markers, especialy usefull *) (* to draw a grid or place some symbols. *) (* *) (* 26.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXMARK; FROM GSXMAIN IMPORT VECTOR; CONST dot = 1; plus = 2; (* Available markertypes *) asterix = 3; circle = 4; cross = 5; PROCEDURE SetMarker ( Number : CARDINAL; VAR Points : ARRAY OF VECTOR ); (* Displayes a Number of markers. *) PROCEDURE MarkerType ( Type : CARDINAL ); (* Select a marker type ( see above ). *) PROCEDURE MarkerScale ( Scale : CARDINAL ); (* Set Marker scale. *) PROCEDURE MarkerColor ( Color : CARDINAL ); (* Set Marker color index. *) END GSXMARK. (****************************************************************************) (* *) (* GSX Text Module *) (* =============== *) (* This Module contains all GSX functions for drawing text on graphic *) (* devices. Note that not all functions may be implemented for each device, *) (* but 1 font, 1 size and 1 direction should be available. *) (* *) (* 26.1.1988 Wolfgang Muees, Hagenring 22, 3300 Braunschweig *) (* *) (****************************************************************************) DEFINITION MODULE GSXTEXT; VAR CharWidth : CARDINAL; (* X dimension of an uppercase "W" *) CharHeight : CARDINAL; (* Y dimension of an uppercase "W" *) CellWidth : CARDINAL; (* X Dimension for character & boarder *) CellHeight : CARDINAL; (* Y Dimension for character & boarder *) PROCEDURE DrawText ( X, Y : CARDINAL; Text : ARRAY OF CHAR ); (* Draw a text string, starting at coordinates X,Y. If the string cross screen bounds, nothing harmfull happens, however, you might not se him. Note that Text length is trunced to CinLen ( see GSXMAIN.DEF ). *) PROCEDURE PGC ( X, Y : CARDINAL; Text : ARRAY OF CHAR ); (* Draw graphic characters. Same as DrawText, but the ASCII values in Text are translated in graphic symbols like frames, edges etc. This function is device-dependent ! *) PROCEDURE CharSize ( Height : CARDINAL ); (* Trys to set a text zoom factor. Actual values for text dimensions are returned in GSXTEXT VARs defined above. *) PROCEDURE CharAngle ( Angle : CARDINAL ); (* Sets direction vector for writing text or symbols. Range is from [0..3600] in 1/10 deg. increment. 0 deg. is the normal text direction, values increasing ccw. *) PROCEDURE CharFont ( Number : CARDINAL ); (* Select a text font. Highly device dependent. *) PROCEDURE CharColor ( Color : CARDINAL ); (* Select a character color index. *) END GSXTEXT.