{Received, with thanks, from Dave Bains.}

%option '-low'

type

half = 0..65535;
byte = 0..255 ;
str255 = VARYING [ 255 ] OF CHAR ;
colourmap = packed array [0..255] of half ;

const

black=0; red=1; green=2; blue=4;
yellow=red+green; magenta=red+blue; cyan=blue+green;
white=red+green+blue;

mouseleft=1; mousemiddle=2; mouseright=4;

function mousebuttons %alias 'FRED_GRAPHICS_MOUSEB' : INTEGER ; EXTERNAL ;

function relmousex %alias 'FRED_GRAPHICS_MOUSEX' : INTEGER ; EXTERNAL ;
function relmousey %alias 'FRED_GRAPHICS_MOUSEY' : INTEGER ; EXTERNAL ;
procedure vline %alias 'FRED_GRAPHICS_VLINE' (x, y0, y1:integer) ; EXTERNAL ;
procedure hline %alias 'FRED_GRAPHICS_HLINE' (x0, x1, y:integer) ; EXTERNAL ;
procedure offset %alias 'FRED_GRAPHICS_OFFSET' (x, y:integer) ; EXTERNAL ;
procedure colour %alias 'FRED_GRAPHICS_COLOUR' (colour:integer); EXTERNAL ;
procedure enable %alias 'FRED_GRAPHICS_ENABLE' (planes:integer); EXTERNAL ;
procedure updatecolourmap %alias 'FRED_GRAPHICS_UPCMAP'(var z:colourmap);
  EXTERNAL ;
procedure clear %alias 'FRED_GRAPHICS_CLEAR' ; EXTERNAL ;
procedure halfclear %alias 'FRED_GRAPHICS_HCLEAR' (h:integer) ; EXTERNAL ;
procedure line %alias 'FRED_GRAPHICS_LINE' 
(x0, y0, x1, y1:integer) ; EXTERNAL ;
procedure fill %alias 'FRED_GRAPHICS_FILL' (x0, y0, x1, y1:integer) ; EXTERNAL ;
procedure triangle %alias 'FRED_GRAPHICS_TRIANGLE'
  (x0, y0, x1, y1, x2, y2:integer) ; EXTERNAL ;
procedure trapeze %alias 'FRED_GRAPHICS_TRAPEZE'
  (x00, x01, y0, x10, x11, y1:integer) ; EXTERNAL ;
procedure disc %alias 'FRED_GRAPHICS_DISC' (x, y, r:integer) ; EXTERNAL ;
procedure ring %alias 'FRED_GRAPHICS_RING' (x, y, r:integer) ; EXTERNAL ;
procedure plot %alias 'FRED_GRAPHICS_PLOT' (x, y:integer) ; EXTERNAL ;
procedure textat %alias 'FRED_GRAPHICS_TEXTAT' (x,y:integer) ; EXTERNAL ;
procedure readfont %alias 'FRED_GRAPHICS_READFONT' 
   (ffile : str255 ; VAR font:integer) ; EXTERNAL ;
procedure showsymbol %alias 'FRED_GRAPHICS_SHOWSYM' (k:integer) ; EXTERNAL ;
procedure showstring %alias 'FRED_GRAPHICS_SHOWSTR' (s : str255) ; EXTERNAL ;
procedure font %alias 'FRED_GRAPHICS_FONT' (f:integer) ; EXTERNAL ;
function fontheight %alias 'FRED_GRAPHICS_FONTHT' : INTEGER ; EXTERNAL ;
function fontdepth %alias 'FRED_GRAPHICS_FONTDP' : INTEGER ; EXTERNAL ;
function maxfontwidth %alias 'FRED_GRAPHICS_FONTWX' : INTEGER ; EXTERNAL ;
function minfontwidth %alias 'FRED_GRAPHICS_FONTWN' : INTEGER ; EXTERNAL ;
function stringwidth %alias 'FRED_GRAPHICS_STRNGW' (s:str255) : INTEGER ;
  EXTERNAL ;
function charheight %alias 'FRED_GRAPHICS_CHARHT' (c:integer) : INTEGER ;
  EXTERNAL ;
function chardepth %alias 'FRED_GRAPHICS_CHARDP' (c:integer) : INTEGER ;
  EXTERNAL ;
function charwidth %alias 'FRED_GRAPHICS_CHARWD' (c:integer) : INTEGER ;
  EXTERNAL ;
function textxpos %alias 'FRED_GRAPHICS_XPOS' : INTEGER ; EXTERNAL ;
function textypos %alias 'FRED_GRAPHICS_YPOS' : INTEGER ; EXTERNAL ;
{procedure poly %alias 'FRED_GRAPHICS_POLY' (x, y:integer) ; EXTERNAL ;}
procedure closepoly %alias 'FRED_GRAPHICS_CLOSEPOLY' ; EXTERNAL ;
