--- grx246/pascal/bgi/graph.pas.orig	Thu Sep 23 18:09:30 2004
+++ grx246/pascal/bgi/graph.pas	Thu Sep 23 18:17:59 2004
@@ -18,8 +18,9 @@
 
   22/02/01 patches by Maurice Lombardi <Maurice.Lombardi@ujf-grenoble.fr>
   Necessary to correct the drawpoly and fillpoly declarations.
-  Some changes to make this file compile with more recent versions of
-  gpc. }
+
+  Maurice Lombardi, Frank Heckenbach <frank@pascal.gnu.de>: Some changes
+  to make this file compile with more recent versions of GPC. }
 
 { Define this if you don't want this unit to declare a KeyPressed
   and a ReadKey function. }
@@ -311,7 +312,7 @@
 
 { BGI - API definitions }
 
-procedure DetectGraph(var GraphDriver, GraphMode: CInteger); asmname 'detectgraph';
+procedure DetectGraph(var GraphDriver, GraphMode: Integer);
 procedure InitGraph(var GraphDriver, GraphMode: Integer; PathToDriver: CString);
 procedure SetGraphMode(Mode: CInteger); asmname 'setgraphmode';
 function  GetModeName(ModeNumber: CInteger): WrkString;
@@ -371,7 +372,7 @@
 procedure ClearDevice; asmname '__gr_cleardevice';
 procedure DrawPoly(NumPoints: CCardinal; var PolyPoints { : array of PointType }); asmname '__gr_drawpoly';
 procedure Ellipse(x, y: CInteger; StAngle, EndAngle: CCardinal; XRadius, YRadius: CCardinal); asmname '__gr_ellipse';
-procedure GetAspectRatio(var XAsp, YAsp: CInteger); asmname '__gr_getaspectratio';
+procedure GetAspectRatio(var XAsp, YAsp: Integer);
 function  GetBkColor: CCardinal; asmname '__gr_getbkcolor';
 function  GetColor: CCardinal; asmname '__gr_getcolor';
 procedure GetFillPattern(var FillPattern: FillPatternType); asmname '__gr_getfillpattern';
@@ -392,7 +393,7 @@
 procedure SetActivePage(Page: CCardinal); asmname '__gr_setactivepage';
 procedure SetVisualPage(Page: CCardinal); asmname '__gr_setvisualpage';
 procedure GetDefaultPalette(var Palette: PaletteType);
-procedure GetModeRange(GraphDriver:CInteger; var LoMode, HiMode:CInteger); asmname '__gr_getmoderange';
+procedure GetModeRange(GraphDriver:CInteger; var LoMode, HiMode:Integer);
 
 function  Black       : CInteger;
 function  Blue        : CInteger;
@@ -451,8 +452,7 @@
   Functional in HiColor/TrueColor modes only }
 procedure SetRGBColor(Red, Green, Blue: CCardinal); asmname '__gr_setrgbcolor';
 
-{ Returns the actual RGB palette. Functional in
-  256 color modes only. Won't work on Linux systems }
+{ Returns the actual RGB palette. }
 procedure GetRGBPalette(Color: CInteger; var Red, Green, Blue: CInteger); asmname '__getrgbpalette';
 
 { Transforms the predefined 16 EGA colors (RED, BLUE, MAGENTA, ...)
@@ -474,6 +474,17 @@
 
 implementation
 
+procedure dg(var GraphDriver, GraphMode: CInteger); asmname 'detectgraph';
+procedure DetectGraph(var GraphDriver, GraphMode: Integer);
+var gd, gm: CInteger;
+begin
+  gd := GraphDriver;
+  gm := GraphMode;
+  dg (gd, gm);
+  GraphDriver := gd;
+  GraphMode := gm
+end;
+
 procedure ig(var gd, gm: CInteger; PathToDriver: CString); asmname 'initgraph';
 procedure InitGraph(var GraphDriver, GraphMode: Integer; PathToDriver: CString);
 var gd, gm: CInteger;
@@ -503,11 +514,29 @@
   GetDriverName := CString2String (gdn)
 end;
 
+procedure gar(var XAsp, YAsp: CInteger); asmname '__gr_getaspectratio';
+procedure GetAspectRatio(var XAsp, YAsp: Integer);
+var xa, ya: CInteger;
+begin
+  gar (xa, ya);
+  XAsp := xa;
+  YAsp := ya
+end;
+
 type pPT = ^PaletteType;
 function gdp: pPT; asmname '__gr_getdefaultpalette';
 procedure GetDefaultPalette(var Palette: PaletteType);
 begin
  Palette := gdp^
+end;
+
+procedure gmr(GraphDriver:CInteger; var LoMode, HiMode:CInteger); asmname '__gr_getmoderange';
+procedure GetModeRange(GraphDriver:CInteger; var LoMode, HiMode:Integer);
+var lm, hm: CInteger;
+begin
+  gmr (GraphDriver, lm, hm);
+  LoMode := lm;
+  HiMode := hm
 end;
 
 function InstallUserDriver(const DriverName: String; AutoDetectPtr: Pointer):CInteger;
--- grx246/pascal/jpgtest.pas.orig	Tue May 27 21:19:46 2003
+++ grx246/pascal/jpgtest.pas	Thu Sep 23 18:05:40 2004
@@ -29,7 +29,7 @@
   grc        : GrContextPtr;
   Width, Height : Integer;
   s          : String[81];
-  w, h       : Integer;
+  w, h       : CInteger;
 begin
   GrQueryJpeg( nf,w,h );
   WriteStr( s,nf,' ',w,' ',h,' Scale 1/',Scale );
--- grx246/pascal/imgview.pas.orig	Thu Sep 23 18:06:15 2004
+++ grx246/pascal/imgview.pas	Thu Sep 23 18:06:33 2004
@@ -49,7 +49,8 @@
 
 var
   ImgFileName: TString;
-  ArgStart, ArgN, ImgWidth, ImgHeight, Key: Integer;
+  ArgStart, ArgN, Key: Integer;
+  ImgWidth, ImgHeight: CInteger;
   grc: GrContextPtr;
   Centered: Boolean;
 
