Browse Source

* integer -> smallint to overcome -S2 switch needed for ggi version

peter 26 years ago
parent
commit
62bd7e53ee

+ 7 - 4
rtl/inc/graph/clip.inc

@@ -26,8 +26,8 @@ const
 
 
 
-  function LineClipped(var x1, y1,x2,y2: integer; xmin, ymin,
-      xmax, ymax:integer): boolean;
+  function LineClipped(var x1, y1,x2,y2: smallint; xmin, ymin,
+      xmax, ymax:smallint): boolean;
   {********************************************************}
   { Function LineClipped()                                 }
   {--------------------------------------------------------}
@@ -45,7 +45,7 @@ const
    newx,newy: word;
 
 
-    function outcode(x,y:integer): longint;
+    function outcode(x,y:smallint): longint;
     {********************************************************}
     { Function OutCode()                                     }
     {--------------------------------------------------------}
@@ -142,7 +142,10 @@ end;
 
 {
 $Log$
-Revision 1.6  1999-09-27 12:35:27  jonas
+Revision 1.7  1999-12-20 11:22:35  peter
+  * integer -> smallint to overcome -S2 switch needed for ggi version
+
+Revision 1.6  1999/09/27 12:35:27  jonas
   * execute multiplications before divisions in lineclipped to avoid rounding errors
 
 Revision 1.5  1999/09/18 22:21:09  jonas

+ 19 - 16
rtl/inc/graph/fills.inc

@@ -50,8 +50,8 @@ type
   too mixed, it is fastest (?). Rather than sorting the active edge table
   this way, it is recommened to implement this using a linked list (not
   nearly as much memory is transfered then) }
-   procedure bsort(p : pointer; number : integer; sizeelem :
-      integer; c : compareproc);
+   procedure bsort(p : pointer; number : smallint; sizeelem :
+      smallint; c : compareproc);
    var    i : graph_int;
            swap : boolean;
        temp : pointer;
@@ -277,9 +277,9 @@ end;
 
 type
   TFloodLine = record
-    x1 : Integer;
-    x2 : Integer;
-    y  : Integer;
+    x1 : smallint;
+    x2 : smallint;
+    y  : smallint;
   end;
 
   TDrawnList  = Array[0..StdBuffersize] of TFloodLine;
@@ -298,7 +298,7 @@ var
   s1, s2, s3 : PWordArray;                { Three buffers for scanlines                 }
 
 
-  Procedure PushPoint (x, y : Integer);
+  Procedure PushPoint (x, y : smallint);
   {********************************************************}
   { Adds a  point to the list of points to check if we     }
   { need to draw. Doesn't add the point if there is a      }
@@ -313,7 +313,7 @@ var
      End
   End;
 
-  Procedure PopPoint (Var x, y : Integer);
+  Procedure PopPoint (Var x, y : smallint);
   {********************************************************}
   { Removes a point from the list of points to check, if   }
   { we try to access an illegal point, then the routine    }
@@ -345,7 +345,7 @@ var
   { drawn to the screen. The line added is on the specified}
   { Y axis, from the x1 to x2 coordinates.                 }
   {********************************************************}
-  Procedure AddLinePoints(x1,x2,y: integer);
+  Procedure AddLinePoints(x1,x2,y: smallint);
    begin
      DrawnList[DrawnIndex].x1 := x1;
      DrawnList[DrawnIndex].x2 := x2;
@@ -365,9 +365,9 @@ var
   { Return TRUE if the point is already in the segment list}
   { to draw, otherwise returns FALSE.                      }
   {********************************************************}
-  Function AlreadyDrawn(x, y: integer): boolean;
+  Function AlreadyDrawn(x, y: smallint): boolean;
    var
-    LocalIndex : integer;
+    LocalIndex : smallint;
    begin
     AlreadyDrawn := FALSE;
     LocalIndex := 0;
@@ -389,7 +389,7 @@ var
    end;
 
 
-  Procedure FloodFill (x, y : Integer; Border: word);
+  Procedure FloodFill (x, y : smallint; Border: word);
   {********************************************************}
   { Procedure FloodFill()                                  }
   {--------------------------------------------------------}
@@ -400,12 +400,12 @@ var
   {********************************************************}
   Var
    stemp: PWordArray;
-   Beginx : Integer;
+   Beginx : smallint;
    d, e : Byte;
    Cont : Boolean;
    BackupColor : Word;
-   x1, x2, prevy: integer;
-   Index : Integer;
+   x1, x2, prevy: smallint;
+   Index : smallint;
   Begin
     { init prevy }
     prevy := 32767;
@@ -509,9 +509,12 @@ var
 
 {
 $Log$
-Revision 1.12  1999-12-11 23:41:38  jonas
+Revision 1.13  1999-12-20 11:22:36  peter
+  * integer -> smallint to overcome -S2 switch needed for ggi version
+
+Revision 1.12  1999/12/11 23:41:38  jonas
   * changed definition of getscanlineproc to "getscanline(x1,x2,y:
-    integer; var data);" so it can be used by getimage too
+    smallint; var data);" so it can be used by getimage too
   * changed getimage so it uses getscanline
   * changed floodfill, getscanline16 and definitions in Linux
     include files so they use this new format

+ 177 - 174
rtl/inc/graph/graph.pp

@@ -351,9 +351,9 @@ Interface
 
     type
        RGBRec = packed record
-         Red: integer;
-         Green: integer;
-         Blue : integer;
+         Red: smallint;
+         Green: smallint;
+         Blue : smallint;
        end;
 
        PaletteType = record
@@ -383,27 +383,27 @@ Interface
        FillPatternType = array[1..8] of byte;
 
        PointType = record
-             x,y : integer;
+             x,y : smallint;
        end;
 
        ViewPortType = record
-             x1,y1,x2,y2 : integer;
+             x1,y1,x2,y2 : smallint;
              Clip : boolean;
        end;
 
        ArcCoordsType = record
-             x,y : integer;
-             xstart,ystart : integer;
-             xend,yend : integer;
+             x,y : smallint;
+             xstart,ystart : smallint;
+             xend,yend : smallint;
        end;
 
 {$IFDEF FPC}
-        graph_int = longint;      { platform specific integer used for indexes;
+        graph_int = longint;      { platform specific smallint used for indexes;
                                     should be 16 bits on TP/BP and 32 bits on every-
                                     thing else for speed reasons }
         graph_float = single;   { the platform's preferred floating point size }
 {$ELSE}
-        graph_int = integer;    { platform specific integer used for indexes;
+        graph_int = smallint;    { platform specific smallint used for indexes;
                                   should be 16 bits on TP/BP and 32 bits on every-
                                   thing else for speed reasons }
         graph_float = real;     { the platform's preferred floating point size }
@@ -441,19 +441,19 @@ TYPE
        { drawing routines, it will use the viewport settings, as    }
        { well as clip, and use the current foreground color to plot }
        { the desired pixel.                                         }
-       defpixelproc = procedure(X,Y: Integer);
+       defpixelproc = procedure(X,Y: smallint);
 
        { standard plot and get pixel                                }
-       getpixelproc = function(X,Y: Integer): word;
-       putpixelproc = procedure(X,Y: Integer; Color: Word);
+       getpixelproc = function(X,Y: smallint): word;
+       putpixelproc = procedure(X,Y: smallint; Color: Word);
 
        { clears the viewport, also used to clear the device         }
        clrviewproc  = procedure;
 
        { putimage procedure, can be hooked to accomplish transparency }
-       putimageproc = procedure (X,Y: Integer; var Bitmap; BitBlt: Word);
-       getimageproc = procedure(X1,Y1,X2,Y2: Integer; Var Bitmap);
-       imagesizeproc= function (X1,Y1,X2,Y2: Integer): longint;
+       putimageproc = procedure (X,Y: smallint; var Bitmap; BitBlt: Word);
+       getimageproc = procedure(X1,Y1,X2,Y2: smallint; Var Bitmap);
+       imagesizeproc= function (X1,Y1,X2,Y2: smallint): longint;
 
        graphfreememprc = procedure (var P: Pointer; size: word);
        graphgetmemprc  = procedure (var P: pointer; size: word);
@@ -462,29 +462,29 @@ TYPE
 
        { draw filled horizontal lines using current color }
        { on entry coordinates are already clipped.        }
-       hlineproc = procedure (x, x2,y : integer);
+       hlineproc = procedure (x, x2,y : smallint);
        { on entry coordinates are already clipped.        }
        { draw filled vertical line using current color    }
-       vlineproc = procedure (x,y,y2: integer);
+       vlineproc = procedure (x,y,y2: smallint);
 
        { this routine is used to draw filled patterns for all routines }
        { that require it. (FillPoly, FloodFill, Sector, etc...         }
        { clipping is verified, uses current Fill settings for drawing  }
-       patternlineproc = procedure (x1,x2,y: integer);
+       patternlineproc = procedure (x1,x2,y: smallint);
 
        { this routine is used to draw all circles/ellipses/sectors     }
        { more info... on this later...                                 }
-       ellipseproc = procedure (X,Y: Integer;XRadius: word;
+       ellipseproc = procedure (X,Y: smallint;XRadius: word;
          YRadius:word; stAngle,EndAngle: word; fp: PatternLineProc);
 
        { Line routine - draws lines thick/norm widths with current     }
        { color and line style - LINE must be clipped here.             }
-       lineproc = procedure (X1, Y1, X2, Y2 : Integer);
+       lineproc = procedure (X1, Y1, X2, Y2 : smallint);
 
        { this routine is used for FloodFill - it returns an entire      }
        { screen scan line with a word for each pixel in the scanline.   }
        { Also handy for GetImage, so I added x coords as well (JM)      }
-       getscanlineproc = procedure (X1, X2, Y : integer; var data);
+       getscanlineproc = procedure (X1, X2, Y : smallint; var data);
 
        { changes the active display screen where we draw to... }
        setactivepageproc = procedure (page: word);
@@ -502,12 +502,12 @@ TYPE
 
        { This routine is a hook for SetRGBPalette                       }
        setrgbpaletteproc =
-         procedure(ColorNum, RedValue, GreenValue, BlueValue: Integer);
+         procedure(ColorNum, RedValue, GreenValue, BlueValue: smallint);
 
        { This routine is a hook for GetRGBPalette                       }
        getrgbpaletteproc =
-         procedure(ColorNum: integer; var
-            RedValue, GreenValue, BlueValue: Integer);
+         procedure(ColorNum: smallint; var
+            RedValue, GreenValue, BlueValue: smallint);
 
 
 TYPE
@@ -524,14 +524,14 @@ TYPE
     {-----------------------------------}
     PModeInfo = ^TModeInfo;
     TModeInfo = record
-      DriverNumber: Integer;
-      ModeNumber: Integer;
+      DriverNumber: smallint;
+      ModeNumber: smallint;
       MaxColor: Longint;            { Maximum colors on screen        }
       PaletteSize : Longint;        { Maximum palette entry we can change }
-      XAspect : Integer;            { XAspect ratio correction factor }
-      YAspect : Integer;            { YAspect ratio correction factor }
-      MaxX: Integer;                { Max-X row                       }
-      MaxY: Integer;                { Max. column.                    }
+      XAspect : smallint;            { XAspect ratio correction factor }
+      YAspect : smallint;            { YAspect ratio correction factor }
+      MaxX: smallint;                { Max-X row                       }
+      MaxY: smallint;                { Max. column.                    }
       DirectColor: boolean;         { Is this a direct color mode??   }
       Hardwarepages: byte;          { total number of image pages - 1 }
       ModeName: String[18];
@@ -590,35 +590,35 @@ VAR
 
 Procedure Closegraph;
 procedure SetLineStyle(LineStyle: word; Pattern: word; Thickness: word);
-function  GraphErrorMsg(ErrorCode: Integer): string;
-Function  GetMaxX: Integer;
-Function  GetMaxY: Integer;
-Procedure SetViewPort(X1, Y1, X2, Y2: Integer; Clip: Boolean);
-Function  GraphResult: Integer;
-function  GetModeName(ModeNumber: integer): string;
-procedure SetGraphMode(Mode: Integer);
-function GetGraphMode: Integer;
+function  GraphErrorMsg(ErrorCode: smallint): string;
+Function  GetMaxX: smallint;
+Function  GetMaxY: smallint;
+Procedure SetViewPort(X1, Y1, X2, Y2: smallint; Clip: Boolean);
+Function  GraphResult: smallint;
+function  GetModeName(ModeNumber: smallint): string;
+procedure SetGraphMode(Mode: smallint);
+function GetGraphMode: smallint;
 function GetMaxMode: word;
 procedure RestoreCrtMode;
-procedure GetModeRange(GraphDriver: Integer; var LoMode, HiMode: Integer);
-Function  GetX: Integer;
-Function  GetY: Integer;
+procedure GetModeRange(GraphDriver: smallint; var LoMode, HiMode: smallint);
+Function  GetX: smallint;
+Function  GetY: smallint;
 procedure GraphDefaults;
 procedure ClearDevice;
 procedure GetViewSettings(var viewport : ViewPortType);
-procedure SetWriteMode(WriteMode : integer);
+procedure SetWriteMode(WriteMode : smallint);
 procedure GetFillSettings(var Fillinfo:Fillsettingstype);
 procedure GetFillPattern(var FillPattern:FillPatternType);
 procedure GetLineSettings(var ActiveLineInfo : LineSettingsType);
-procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;const PathToDriver:String);
-procedure DetectGraph(var GraphDriver:Integer;var GraphMode:Integer);
-function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): integer;
-function RegisterBGIDriver(driver: pointer): integer;
+procedure InitGraph(var GraphDriver:smallint;var GraphMode:smallint;const PathToDriver:String);
+procedure DetectGraph(var GraphDriver:smallint;var GraphMode:smallint);
+function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
+function RegisterBGIDriver(driver: pointer): smallint;
 procedure SetFillStyle(Pattern : word; Color: word);
 procedure SetFillPattern(Pattern: FillPatternType; Color: word);
 Function GetDriverName: string;
- procedure MoveRel(Dx, Dy: Integer);
- procedure MoveTo(X,Y: Integer);
+ procedure MoveRel(Dx, Dy: smallint);
+ procedure MoveTo(X,Y: smallint);
 
  procedure SetDirectVideo(DirectAccess: boolean);
  function GetDirectVideo: boolean;
@@ -633,19 +633,19 @@ Function GetDriverName: string;
  procedure SetAllPalette(var Palette:PaletteType);
  procedure SetPalette(ColorNum: word; Color: shortint);
  procedure GetPalette(var Palette: PaletteType);
- function GetPaletteSize: integer;
+ function GetPaletteSize: smallint;
  procedure GetDefaultPalette(var Palette: PaletteType);
 
 
  { -------------------- Shapes/Lines -------------------------------- }
- procedure Rectangle(x1,y1,x2,y2:integer);
- procedure Bar(x1,y1,x2,y2:integer);
- procedure Bar3D(x1, y1, x2, y2 : integer;depth : word;top : boolean);
+ procedure Rectangle(x1,y1,x2,y2:smallint);
+ procedure Bar(x1,y1,x2,y2:smallint);
+ procedure Bar3D(x1, y1, x2, y2 : smallint;depth : word;top : boolean);
  procedure FillPoly(NumPoints: word; Var PolyPoints);
  procedure DrawPoly(NumPoints : word;var polypoints);
- procedure LineRel(Dx, Dy: Integer);
- procedure LineTo(X,Y : Integer);
- procedure FloodFill(x : integer; y : integer; Border: word);
+ procedure LineRel(Dx, Dy: smallint);
+ procedure LineTo(X,Y : smallint);
+ procedure FloodFill(x : smallint; y : smallint; Border: word);
 
  { -------------------- Circle related routines --------------------- }
  procedure GetAspectRatio(var Xasp,Yasp : word);
@@ -653,17 +653,17 @@ Function GetDriverName: string;
  procedure GetArcCoords(var ArcCoords: ArcCoordsType);
 
 
- procedure Arc(X,Y : Integer; StAngle,EndAngle,Radius: word);
- procedure PieSlice(X,Y,stangle,endAngle:integer;Radius: Word);
- procedure FillEllipse(X, Y: Integer; XRadius, YRadius: Word);
- procedure Circle(X, Y: Integer; Radius:Word);
- procedure Sector(x, y: Integer; StAngle,EndAngle, XRadius, YRadius: Word);
- procedure Ellipse(X,Y : Integer; stAngle, EndAngle: word; XRadius,
+ procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
+ procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
+ procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
+ procedure Circle(X, Y: smallint; Radius:Word);
+ procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
+ procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
    YRadius: word);
 
  { --------------------- Text related routines --------------------- }
- function  InstallUserFont(const FontFileName : string) : integer;
- function  RegisterBGIfont(font : pointer) : integer;
+ function  InstallUserFont(const FontFileName : string) : smallint;
+ function  RegisterBGIfont(font : pointer) : smallint;
  procedure GetTextSettings(var TextInfo : TextSettingsType);
  function  TextHeight(const TextString : string) : word;
  function  TextWidth(const TextString : string) : word;
@@ -671,7 +671,7 @@ Function GetDriverName: string;
  procedure SetTextStyle(font,direction : word;charsize : word);
  procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
 
- procedure OutTextXY(x,y : integer;const TextString : string);
+ procedure OutTextXY(x,y : smallint;const TextString : string);
  procedure OutText(const TextString : string);
 
 { Load extra graph additions per system like mode constants }
@@ -729,7 +729,7 @@ const
 type
 
 
-  tinttable = array[0..16383] of integer;
+  tinttable = array[0..16383] of smallint;
   pinttable = ^tinttable;
 
   WordArray = Array [0..StdbufferSize] Of word;
@@ -762,16 +762,16 @@ const
 var
   CurrentColor:     Word;
   CurrentBkColor: Word;
-  CurrentX : Integer;   { viewport relative }
-  CurrentY : Integer;   { viewport relative }
+  CurrentX : smallint;   { viewport relative }
+  CurrentY : smallint;   { viewport relative }
 
   ClipPixels: Boolean;  { Should cliiping be enabled }
 
 
-  CurrentWriteMode: Integer;
+  CurrentWriteMode: smallint;
 
 
-  _GraphResult : Integer;
+  _GraphResult : smallint;
 
 
   LineInfo : LineSettingsType;
@@ -783,10 +783,10 @@ var
   installedfonts: longint;  { Number of installed fonts }
 
 
-  StartXViewPort: Integer; { absolute }
-  StartYViewPort: Integer; { absolute }
-  ViewWidth : Integer;
-  ViewHeight: Integer;
+  StartXViewPort: smallint; { absolute }
+  StartYViewPort: smallint; { absolute }
+  ViewWidth : smallint;
+  ViewHeight: smallint;
 
 
   IsGraphMode : Boolean; { Indicates if we are in graph mode or not }
@@ -799,12 +799,12 @@ var
 
   { ******************** HARDWARE INFORMATION ********************* }
   { Should be set in InitGraph once only.                           }
-  IntCurrentMode : Integer;
-  IntCurrentDriver : Integer;       { Currently loaded driver          }
-  XAspect : Integer;
-  YAspect : Integer;
-  MaxX : Integer;       { Maximum resolution - ABSOLUTE }
-  MaxY : Integer;       { Maximum resolution - ABSOLUTE }
+  IntCurrentMode : smallint;
+  IntCurrentDriver : smallint;       { Currently loaded driver          }
+  XAspect : smallint;
+  YAspect : smallint;
+  MaxX : smallint;       { Maximum resolution - ABSOLUTE }
+  MaxY : smallint;       { Maximum resolution - ABSOLUTE }
   MaxColor : Longint;
   PaletteSize : longint; { Maximum palette entry we can set, usually equal}
                          { maxcolor.                                      }
@@ -825,10 +825,10 @@ var
 
   {$i clip.inc}
 
-  procedure HLineDefault(x,x2,y: integer); {$ifndef fpc}far;{$endif fpc}
+  procedure HLineDefault(x,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
 
    var
-    xtmp: integer;
+    xtmp: smallint;
    Begin
 
     { must we swap the values? }
@@ -853,10 +853,10 @@ var
    end;
 
 
-  procedure VLineDefault(x,y,y2: integer); {$ifndef fpc}far;{$endif fpc}
+  procedure VLineDefault(x,y,y2: smallint); {$ifndef fpc}far;{$endif fpc}
 
    var
-    ytmp: integer;
+    ytmp: smallint;
   Begin
     { must we swap the values? }
     if y >= y2 then
@@ -878,7 +878,7 @@ var
     for y := y to y2 do Directputpixel(x,y)
   End;
 
-  Procedure DirectPutPixelClip(x,y: Integer);
+  Procedure DirectPutPixelClip(x,y: smallint);
   { for thickwidth lines, because they may call DirectPutPixel for coords }
   { outside the current viewport (bug found by CEC)                       }
   Begin
@@ -890,22 +890,22 @@ var
       End
   End;
 
-  procedure LineDefault(X1, Y1, X2, Y2: Integer); {$ifndef fpc}far;{$endif fpc}
+  procedure LineDefault(X1, Y1, X2, Y2: smallint); {$ifndef fpc}far;{$endif fpc}
 
-  var X, Y :           Integer;
-      deltax, deltay : Integer;
-      d, dinc1, dinc2: Integer;
-      xinc1          : Integer;
-      xinc2          : Integer;
-      yinc1          : Integer;
-      yinc2          : Integer;
-      i              : Integer;
+  var X, Y :           smallint;
+      deltax, deltay : smallint;
+      d, dinc1, dinc2: smallint;
+      xinc1          : smallint;
+      xinc2          : smallint;
+      yinc1          : smallint;
+      yinc2          : smallint;
+      i              : smallint;
       Flag           : Boolean; { determines pixel direction in thick lines }
-      NumPixels      : Integer;
-      PixelCount     : Integer;
+      NumPixels      : smallint;
+      PixelCount     : smallint;
       OldCurrentColor: Word;
-      swtmp          : integer;
-      TmpNumPixels   : integer;
+      swtmp          : smallint;
+      TmpNumPixels   : smallint;
  begin
 {******************************************}
 {  SOLID LINES                             }
@@ -1303,7 +1303,7 @@ var
   { can be passed as a patternlineproc for non-filled      }
   { ellipses                                               }
   {********************************************************}
-  Procedure DummyPatternLine(x1, x2, y: integer); {$ifdef tp} far; {$endif tp}
+  Procedure DummyPatternLine(x1, x2, y: smallint); {$ifdef tp} far; {$endif tp}
   begin
   end;
 
@@ -1329,7 +1329,7 @@ var
   {       -                                                }
   {********************************************************}
 
-  Procedure InternalEllipseDefault(X,Y: Integer;XRadius: word;
+  Procedure InternalEllipseDefault(X,Y: smallint;XRadius: word;
     YRadius:word; stAngle,EndAngle: word; pl: PatternLineProc); {$ifndef fpc}far;{$endif fpc}
    Const ConvFac = Pi/180.0;
 
@@ -1338,7 +1338,7 @@ var
     NumOfPixels: longint;
     TempTerm: graph_float;
     xtemp, ytemp, xp, yp, xm, ym, xnext, ynext,
-      plxpyp, plxmyp, plxpym, plxmym: integer;
+      plxpyp, plxmyp, plxpym, plxmym: smallint;
     BackupColor, DeltaAngle, TmpAngle, OldLineWidth: word;
   Begin
    If LineInfo.ThickNess = ThickWidth Then
@@ -1432,10 +1432,10 @@ var
      xm := x - xtemp;
      yp := y + ytemp;
      ym := y - ytemp;
-     plxpyp := maxint;
-     plxmyp := -maxint-1;
-     plxpym := maxint;
-     plxmym := -maxint-1;
+     plxpyp := maxsmallint;
+     plxmyp := -maxsmallint-1;
+     plxpym := maxsmallint;
+     plxmym := -maxsmallint-1;
      If (j >= StAngle) and (j <= EndAngle) then
        begin
          plxpyp := xp;
@@ -1487,14 +1487,14 @@ var
   {       - Angles must both be between 0 and 360          }
   {********************************************************}
 (*
-Procedure InternalEllipseDefault (x, y : integer;
+Procedure InternalEllipseDefault (x, y : smallint;
     xradius, yradius, stAngle, EndAngle : Word; pl: PatternLineProc); {$ifndef fpc} far; {$endif fpc}
 { Draw an ellipse arc. Crude but it works (anyone have a better one?) }
 Var
   aSqr, bSqr, twoaSqr, twobSqr, xa, ya, twoXbSqr, twoYaSqr, error : LongInt;
   Alpha, TempTerm : graph_float;
   BackupColor: Word;
-  plxpyp, plxmyp, plxpym, plxmym: integer;
+  plxpyp, plxmyp, plxpym, plxmym: smallint;
 const
   RadToDeg = 180/Pi;
 
@@ -1502,18 +1502,18 @@ const
 Procedure PlotPoints;
 
 var
- i,j: integer;
- xm, ym: integer;
- xp, yp: integer;
+ i,j: smallint;
+ xm, ym: smallint;
+ xp, yp: smallint;
 Begin
    ym := y-ya;
    yp := y+ya;
    xm := x-xa;
    xp := x+xa;
-   plxpyp := maxint;
-   plxmyp := -maxint-1;
-   plxpym := maxint;
-   plxmym := -maxint-1;
+   plxpyp := maxsmallint;
+   plxmyp := -maxsmallint-1;
+   plxpym := maxsmallint;
+   plxmym := -maxsmallint-1;
    if LineInfo.Thickness = Normwidth then
      Begin
        If (Alpha+270>=StAngle) And (Alpha+270<=EndAngle) then
@@ -1655,7 +1655,7 @@ Begin
   End;
 End;
 *)
-  procedure PatternLineDefault(x1,x2,y: integer); {$ifndef fpc}far;{$endif fpc}
+  procedure PatternLineDefault(x1,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
   {********************************************************}
   { Draws a horizontal patterned line according to the     }
   { current Fill Settings.                                 }
@@ -1665,9 +1665,9 @@ End;
   {    this routine.                                       }
   {********************************************************}
    var
-    NrIterations: Integer;
-    i           : Integer;
-    j           : Integer;
+    NrIterations: smallint;
+    i           : smallint;
+    j           : smallint;
     TmpFillPattern : byte;
     OldWriteMode : word;
     OldCurrentColor : word;
@@ -1741,7 +1741,7 @@ End;
 
 
 
-  procedure LineRel(Dx, Dy: Integer);
+  procedure LineRel(Dx, Dy: smallint);
 
    Begin
      Line(CurrentX, CurrentY, CurrentX + Dx, CurrentY + Dy);
@@ -1750,7 +1750,7 @@ End;
    end;
 
 
-  procedure LineTo(x,y : Integer);
+  procedure LineTo(x,y : smallint);
 
    Begin
      Line(CurrentX, CurrentY, X, Y);
@@ -1761,7 +1761,7 @@ End;
 
 
 
-  procedure Rectangle(x1,y1,x2,y2:integer);
+  procedure Rectangle(x1,y1,x2,y2:smallint);
 
    begin
      { Do not draw the end points }
@@ -1825,7 +1825,7 @@ End;
 
 Procedure ClearViewPortDefault; {$ifndef fpc}far;{$endif fpc}
 var
- j: integer;
+ j: smallint;
  OldWriteMode, OldCurColor: word;
  LineSets : LineSettingsType;
 Begin
@@ -1852,7 +1852,7 @@ Begin
 end;
 
 
-Procedure SetViewPort(X1, Y1, X2, Y2: Integer; Clip: Boolean);
+Procedure SetViewPort(X1, Y1, X2, Y2: smallint; Clip: Boolean);
 Begin
   if (X1 > GetMaxX) or (X2 > GetMaxX) or (X1 > X2) or (X1 < 0) then
   Begin
@@ -1921,7 +1921,7 @@ end;
 {--------------------------------------------------------------------------}
 
 
-  Procedure GetScanlineDefault (X1, X2, Y : Integer; Var Data); {$ifndef fpc}far;{$endif fpc}
+  Procedure GetScanlineDefault (X1, X2, Y : smallint; Var Data); {$ifndef fpc}far;{$endif fpc}
   {**********************************************************}
   { Procedure GetScanLine()                                  }
   {----------------------------------------------------------}
@@ -1935,7 +1935,7 @@ end;
 
 
   Var
-    x : Integer;
+    x : smallint;
   Begin
      For x:=X1 to X2 Do
        WordArray(Data)[x-x1]:=GetPixel(x, y);
@@ -1943,21 +1943,21 @@ end;
 
 
 
-Function DefaultImageSize(X1,Y1,X2,Y2: Integer): longint; {$ifndef fpc}far;{$endif fpc}
+Function DefaultImageSize(X1,Y1,X2,Y2: smallint): longint; {$ifndef fpc}far;{$endif fpc}
 Begin
   { each pixel uses two bytes, to enable modes with colors up to 64K }
   { to work.                                                         }
   DefaultImageSize := 12 + (((X2-X1+1)*(Y2-Y1+1))*2);
 end;
 
-Procedure DefaultPutImage(X,Y: Integer; var Bitmap; BitBlt: Word); {$ifndef fpc}far;{$endif fpc}
+Procedure DefaultPutImage(X,Y: smallint; var Bitmap; BitBlt: Word); {$ifndef fpc}far;{$endif fpc}
 type
   pt = array[0..$fffffff] of word;
   ptw = array[0..2] of longint;
 var
   k: longint;
   oldCurrentColor, color: word;
-  oldCurrentWriteMode, i, j, y1, x1, deltaX, deltaX1, deltaY: Integer;
+  oldCurrentWriteMode, i, j, y1, x1, deltaX, deltaX1, deltaY: smallint;
 Begin
 {$ifdef logging}
   LogLn('putImage at ('+strf(x)+','+strf(y)+') with width '+strf(ptw(Bitmap)[0])+
@@ -2015,12 +2015,12 @@ Begin
   currentColor := oldCurrentColor;
 end;
 
-Procedure DefaultGetImage(X1,Y1,X2,Y2: Integer; Var Bitmap); {$ifndef fpc}far;{$endif fpc}
+Procedure DefaultGetImage(X1,Y1,X2,Y2: smallint; Var Bitmap); {$ifndef fpc}far;{$endif fpc}
 type
   pt = array[0..$fffffff] of word;
   ptw = array[0..2] of longint;
 var
-  i,j: integer;
+  i,j: smallint;
   k: longint;
 Begin
   k:= 3 * Sizeof(longint) div sizeof(word); { Three reserved longs at start of bitmap }
@@ -2060,29 +2060,29 @@ end;
    begin
    end;
 
-  procedure DirectPutPixelDefault(X,Y: Integer);
+  procedure DirectPutPixelDefault(X,Y: smallint);
    begin
      RunError(218);
    end;
 
-  function GetPixelDefault(X,Y: Integer): word;
+  function GetPixelDefault(X,Y: smallint): word;
    begin
      RunError(218);
      exit(0); { avoid warning }
    end;
 
-  procedure PutPixelDefault(X,Y: Integer; Color: Word);
+  procedure PutPixelDefault(X,Y: smallint; Color: Word);
    begin
      RunError(218);
    end;
 
-  procedure SetRGBPaletteDefault(ColorNum, RedValue, GreenValue, BlueValue: Integer);
+  procedure SetRGBPaletteDefault(ColorNum, RedValue, GreenValue, BlueValue: smallint);
    begin
      RunError(218);
    end;
 
-  procedure GetRGBPaletteDefault(ColorNum: integer; var
-            RedValue, GreenValue, BlueValue: Integer);
+  procedure GetRGBPaletteDefault(ColorNum: smallint; var
+            RedValue, GreenValue, BlueValue: smallint);
    begin
      RunError(218);
    end;
@@ -2183,13 +2183,13 @@ end;
 {$i palette.inc}
 {$i graph.inc}
 
-  function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): integer;
+  function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
    begin
      _graphResult := grError;
      InstallUserDriver:=grError;
    end;
 
-  function RegisterBGIDriver(driver: pointer): integer;
+  function RegisterBGIDriver(driver: pointer): smallint;
 
    begin
      _graphResult := grError;
@@ -2201,7 +2201,7 @@ end;
 { ----------------------------------------------------------------- }
 
 
-  Procedure Arc(X,Y : Integer; StAngle,EndAngle,Radius: word);
+  Procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
 
 {   var
     OldWriteMode: word;}
@@ -2221,7 +2221,7 @@ end;
    end;
 
 
- procedure Ellipse(X,Y : Integer; stAngle, EndAngle: word; XRadius,YRadius: word);
+ procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,YRadius: word);
   Begin
 {$ifdef fpc}
      InternalEllipse(X,Y,XRadius,YRadius,StAngle,Endangle,@DummyPatternLine);
@@ -2231,7 +2231,7 @@ end;
   end;
 
 
- procedure FillEllipse(X, Y: Integer; XRadius, YRadius: Word);
+ procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
   {********************************************************}
   { Procedure FillEllipse()                                }
   {--------------------------------------------------------}
@@ -2246,7 +2246,7 @@ end;
 
 
 
- procedure Circle(X, Y: Integer; Radius:Word);
+ procedure Circle(X, Y: smallint; Radius:Word);
   {********************************************************}
   { Draws a circle centered at X,Y with the given Radius.  }
   {********************************************************}
@@ -2289,8 +2289,8 @@ end;
      move(OriginalArcInfo, ArcCall,sizeof(ArcCall));
  end;
 
- procedure SectorPL(x1,x2,y: Integer); {$ifndef fpc}far;{$endif fpc}
- var plx1, plx2: integer;
+ procedure SectorPL(x1,x2,y: smallint); {$ifndef fpc}far;{$endif fpc}
+ var plx1, plx2: smallint;
 {$ifdef sectorpldebug}
      t : text;
 {$endif sectorpldebug}
@@ -2301,8 +2301,8 @@ end;
    writeln(t,'Got here for line ',y);
    close(t);
 {$endif sectorpldebug}
-   If (x1 = -maxint) Then
-     If (x2 = maxint-1) Then
+   If (x1 = -maxsmallint) Then
+     If (x2 = maxsmallint-1) Then
        { no ellipse points drawn on this line }
        If (((Y < ArcCall.Y) and (Y > ArcCall.YStart)) or
           ((Y > ArcCall.Y) and (Y < ArcCall.YStart))) Then
@@ -2391,7 +2391,7 @@ end;
 {$endif sectorpldebug}
        End
    Else
-     If (x2 = maxint-1) Then
+     If (x2 = maxsmallint-1) Then
        { the arc is plotted at the left side, but not at the rigth side.   }
        { the right limit can be either the first or second line. Just take }
        { the closest one, but watch out for division by zero!              }
@@ -2454,7 +2454,7 @@ end;
      end;
  end;
 
- procedure Sector(x, y: Integer; StAngle,EndAngle, XRadius, YRadius: Word);
+ procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
 (*  var angle : graph_float;
       writemode : word; *)
   begin
@@ -2492,7 +2492,7 @@ end;
   { it can still be used with SetFillStyle(UserFill,Color) }
   {********************************************************}
    var
-    i: integer;
+    i: smallint;
 
    begin
      if Color > GetMaxColor then
@@ -2510,16 +2510,16 @@ end;
 
    end;
 
-  procedure Bar(x1,y1,x2,y2:integer);
+  procedure Bar(x1,y1,x2,y2:smallint);
   {********************************************************}
   { Important notes for compatibility with BP:             }
   {     - WriteMode is always CopyPut                      }
   {     - No contour is drawn for the lines                }
   {********************************************************}
-  var y               : Integer;
+  var y               : smallint;
       origcolor       : longint;
       origlinesettings: Linesettingstype;
-      origwritemode   : Integer;
+      origwritemode   : smallint;
    begin
      origlinesettings:=lineinfo;
      origcolor:=CurrentColor;
@@ -2566,10 +2566,10 @@ end;
 
 
 
-procedure bar3D(x1, y1, x2, y2 : integer;depth : word;top : boolean);
+procedure bar3D(x1, y1, x2, y2 : smallint;depth : word;top : boolean);
 var
- origwritemode : integer;
- OldX, OldY : integer;
+ origwritemode : smallint;
+ OldX, OldY : smallint;
 begin
   origwritemode := CurrentWriteMode;
   CurrentWriteMode := CopyPut;
@@ -2661,13 +2661,13 @@ end;
 
 
 
-   Procedure MoveRel(Dx, Dy: Integer);
+   Procedure MoveRel(Dx, Dy: smallint);
     Begin
      CurrentX := CurrentX + Dx;
      CurrentY := CurrentY + Dy;
    end;
 
-   Procedure MoveTo(X,Y: Integer);
+   Procedure MoveTo(X,Y: smallint);
   {********************************************************}
   { Procedure MoveTo()                                     }
   {--------------------------------------------------------}
@@ -2680,7 +2680,7 @@ end;
     end;
 
 
-function GraphErrorMsg(ErrorCode: Integer): string;
+function GraphErrorMsg(ErrorCode: smallint): string;
 Begin
  GraphErrorMsg:='';
  case ErrorCode of
@@ -2701,13 +2701,13 @@ end;
 
 
 
-  Function GetMaxX: Integer;
+  Function GetMaxX: smallint;
   { Routine checked against VGA driver - CEC }
    Begin
      GetMaxX := MaxX;
    end;
 
-  Function GetMaxY: Integer;
+  Function GetMaxY: smallint;
   { Routine checked against VGA driver - CEC }
    Begin
     GetMaxY := MaxY;
@@ -2716,20 +2716,20 @@ end;
 
 
 
-Function GraphResult: Integer;
+Function GraphResult: smallint;
 Begin
   GraphResult := _GraphResult;
   _GraphResult := grOk;
 end;
 
 
-  Function GetX: Integer;
+  Function GetX: smallint;
    Begin
      GetX := CurrentX;
    end;
 
 
-  Function GetY: Integer;
+  Function GetY: smallint;
    Begin
      GetY := CurrentY;
    end;
@@ -2746,7 +2746,7 @@ end;
    { returned values even if GraphDefaults is called in    }
    { between.                                              }
     var
-     i: integer;
+     i: smallint;
    begin
      lineinfo.linestyle:=solidln;
      lineinfo.thickness:=normwidth;
@@ -2806,7 +2806,7 @@ end;
   end;
 
 
-  procedure SetWriteMode(WriteMode : integer);
+  procedure SetWriteMode(WriteMode : smallint);
   { TP sets the writemodes according to the following scheme (JM) }
    begin
      Case writemode of
@@ -2854,7 +2854,7 @@ end;
     end;
 
 
-  procedure PieSlice(X,Y,stangle,endAngle:integer;Radius: Word);
+  procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
   begin
     Sector(x,y,stangle,endangle,radius,radius);
   end;
@@ -2863,10 +2863,10 @@ end;
 {$i gtext.inc}
 
 
-  procedure DetectGraph(var GraphDriver:Integer;var GraphMode:Integer);
-  var LoMode, HiMode: Integer;
-      CpyMode: Integer;
-      CpyDriver: Integer;
+  procedure DetectGraph(var GraphDriver:smallint;var GraphMode:smallint);
+  var LoMode, HiMode: smallint;
+      CpyMode: smallint;
+      CpyDriver: smallint;
   begin
     HiMode := -1;
     LoMode := -1;
@@ -2896,7 +2896,7 @@ end;
     GraphMode := CpyMode;
   end;
 
-  procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;
+  procedure InitGraph(var GraphDriver:smallint;var GraphMode:smallint;
     const PathToDriver:String);
   begin
     InitVars;
@@ -3034,7 +3034,10 @@ SetGraphBufSize
 
 {
   $Log$
-  Revision 1.47  1999-12-12 13:34:20  jonas
+  Revision 1.48  1999-12-20 11:22:36  peter
+    * integer -> smallint to overcome -S2 switch needed for ggi version
+
+  Revision 1.47  1999/12/12 13:34:20  jonas
     * putimage now performs the lipping itself and uses directputpixel
       (note: this REQUIRES or/and/notput support in directputpixel,
       this is not yet the case in the assembler versions!)
@@ -3043,7 +3046,7 @@ SetGraphBufSize
 
   Revision 1.46  1999/12/11 23:41:38  jonas
     * changed definition of getscanlineproc to "getscanline(x1,x2,y:
-      integer; var data);" so it can be used by getimage too
+      smallint; var data);" so it can be used by getimage too
     * changed getimage so it uses getscanline
     * changed floodfill, getscanline16 and definitions in Linux
       include files so they use this new format
@@ -3071,7 +3074,7 @@ SetGraphBufSize
    * memory corruption within GetImage removed
 
   Revision 1.39  1999/11/24 23:42:31  pierre
-    * PutImage used an integer index that became negative !!!!
+    * PutImage used an smallint index that became negative !!!!
     * Default needed procedure now genrate a RTE 218 instead of a
       GPF by call to nil pointer !
 

+ 45 - 45
rtl/inc/graph/graph.tex

@@ -310,7 +310,7 @@ are also possible for those who wish to optimize the speed of the unit.
 -------------------------------------------------------------
 \begin{function}{GetModeName}
 \Declaration
-Function GetModeName (ModeNumber : Integer) : String;
+Function GetModeName (ModeNumber : smallint) : String;
 
 \Description
 
@@ -430,7 +430,7 @@ None.
 ---------------------------
 \begin{procedure}{GetRGBPalette}
 \Declaration
-Procedure GetRGBPalette (ColorNum: intege; var Red,Green,Blue : Integer);
+Procedure GetRGBPalette (ColorNum: intege; var Red,Green,Blue : smallint);
 
 \Description
 \var{GetRGBPalette} gets the \var{ColorNum}-th entry in the palette.
@@ -522,7 +522,7 @@ None.
 \subsection{Types}
 \begin{verbatim}
 ArcCoordsType = record
- X,Y,Xstart,Ystart,Xend,Yend : Integer;
+ X,Y,Xstart,Ystart,Xend,Yend : smallint;
 end;
 FillPatternType = Array [1..8] of Byte;
 FillSettingsType = Record
@@ -535,13 +535,13 @@ end;
 
 
 PointType = Record
-  X,Y : Integer;
+  X,Y : smallint;
 end;
 TextSettingsType = Record
  Font,Direction, CharSize, Horiz, Vert : Word
 end;
 ViewPortType = Record
-  X1,Y1,X2,Y2 : Integer;
+  X1,Y1,X2,Y2 : smallint;
   Clip : Boolean
 end;
 \end{verbatim}
@@ -566,7 +566,7 @@ across different hardware platforms.
 
 \begin{procedure}{Arc}
 \Declaration
-Procedure Arc (X,Y : Integer; stAngle,Endangle, radius : Word);
+Procedure Arc (X,Y : smallint; stAngle,Endangle, radius : Word);
 
 \Description
  \var{Arc} draws part of a circle with center at \var{(X,Y)}, radius
@@ -582,7 +582,7 @@ None.
 
 \begin{procedure}{Bar}
 \Declaration
-Procedure Bar (X1,Y1,X2,Y2 : Integer);
+Procedure Bar (X1,Y1,X2,Y2 : smallint);
 
 \Description
 Draws a rectangle with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
@@ -596,7 +596,7 @@ None.
 
 \begin{procedure}{Bar3D}
 \Declaration
-Procedure Bar3D (X1,Y1,X2,Y2 : Integer; depth : Word; Top : Boolean);
+Procedure Bar3D (X1,Y1,X2,Y2 : smallint; depth : Word; Top : Boolean);
 
 \Description
 Draws a 3-dimensional Bar  with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
@@ -612,7 +612,7 @@ None.
 
 \begin{procedure}{Circle}
 \Declaration
-Procedure Circle (X,Y : Integer; Radius : Word);
+Procedure Circle (X,Y : smallint; Radius : Word);
 
 \Description
  \var{Circle} draws part of a circle with center at \var{(X,Y)}, radius
@@ -667,7 +667,7 @@ None.
 
 \begin{procedure}{DetectGraph}
 \Declaration
-Procedure DetectGraph (Var Driver, Modus : Integer);
+Procedure DetectGraph (Var Driver, Modus : smallint);
 
 \Description
  Checks the hardware in the PC and determines the driver and screen-modus to
@@ -701,7 +701,7 @@ None.
 
 \begin{procedure}{Ellipse}
 \Declaration
-Procedure Ellipse (X,Y : Integer; StAngle,EndAngle,XRadius,YRadius : Word);
+Procedure Ellipse (X,Y : smallint; StAngle,EndAngle,XRadius,YRadius : Word);
 
 \Description
  \var{Ellipse} draws part of an ellipse with center at \var{(X,Y)}.
@@ -719,7 +719,7 @@ None.
 \end{procedure}
 \begin{procedure}{FillEllipse}
 \Declaration
-Procedure FillEllipse (X,Y : Integer; Xradius,YRadius: Word);
+Procedure FillEllipse (X,Y : smallint; Xradius,YRadius: Word);
 
 \Description
  \var{Ellipse} draws an ellipse with center at \var{(X,Y)}.
@@ -750,7 +750,7 @@ None.
 \end{procedure}
 \begin{procedure}{FloodFill}
 \Declaration
-Procedure FloodFill (X,Y : Integer; BorderColor : Word);
+Procedure FloodFill (X,Y : smallint; BorderColor : Word);
 
 \Description
 
@@ -846,7 +846,7 @@ None.
 
 \begin{function}{GetGraphMode}
 \Declaration
-Function GetGraphMode  : Integer;
+Function GetGraphMode  : smallint;
 
 \Description
 \var{GetGraphMode} returns the current graphical mode. This value is
@@ -862,7 +862,7 @@ None.
 
 \begin{procedure}{GetImage}
 \Declaration
-Procedure GetImage (X1,Y1,X2,Y2 : Integer, Var Bitmap);
+Procedure GetImage (X1,Y1,X2,Y2 : smallint, Var Bitmap);
 
 \Description
 \var{GetImage}
@@ -954,7 +954,7 @@ None.
 
 \begin{procedure}{GetModeRange}
 \Declaration
-Procedure GetModeRange (GraphDriver : Integer; var LoMode, HiMode: Integer);
+Procedure GetModeRange (GraphDriver : smallint; var LoMode, HiMode: smallint);
 
 \Description
 \var{GetModeRange} returns the Lowest and Highest mode of the currently
@@ -985,7 +985,7 @@ None.
 \end{function}
 \begin{function}{GetPixel}
 \Declaration
-Function GetPixel (X,Y : Integer) : Word;
+Function GetPixel (X,Y : smallint) : Word;
 
 \Description
 \var{GetPixel} returns the color
@@ -1029,7 +1029,7 @@ None.
 
 \begin{function}{GetX}
 \Declaration
-Function GetX  : Integer;
+Function GetX  : smallint;
 
 \Description
 \var{GetX} returns the X-coordinate of the current pointer. This value is
@@ -1041,7 +1041,7 @@ None.
 \end{function}
 \begin{function}{GetY}
 \Declaration
-Function GetY  : Integer;
+Function GetY  : smallint;
 
 \Description
 \var{GetY} returns the Y-coordinate of the current pointer. This value is
@@ -1084,7 +1084,7 @@ None.
 
 \begin{function}{GraphErrorMsg}
 \Declaration
-Function GraphErrorMsg (ErrorCode : Integer) : String;
+Function GraphErrorMsg (ErrorCode : smallint) : String;
 
 \Description
 \var{GraphErrorMsg}
@@ -1097,7 +1097,7 @@ None.
 \end{function}
 \begin{function}{GraphResult}
 \Declaration
-Function GraphResult  : Integer;
+Function GraphResult  : smallint;
 
 \Description
 \var{GraphResult} returns an error-code for
@@ -1119,7 +1119,7 @@ None.
 
 \begin{function}{ImageSize}
 \Declaration
-Function ImageSize (X1,Y1,X2,Y2 : Integer) : longint;
+Function ImageSize (X1,Y1,X2,Y2 : smallint) : longint;
 
 \Description
 \var{ImageSize} returns the number of bytes needed to store the image
@@ -1141,7 +1141,7 @@ None.
 
 \begin{procedure}{InitGraph}
 \Declaration
-Procedure InitGraph (var GraphDriver,GraphModus : integer;\\
+Procedure InitGraph (var GraphDriver,GraphModus : smallint;\\
 const PathToDriver : string);
 
 \Description
@@ -1183,7 +1183,7 @@ Introduction, (page \pageref{se:Introduction}),
 Example:
 \begin{verbatim}
 var
-   gd,gm : integer;
+   gd,gm : smallint;
    PathToDriver : string;
 begin
    gd:=detect; { highest possible resolution }
@@ -1199,7 +1199,7 @@ end.
 
 \begin{function}{InstallUserDriver}
 \Declaration
-Function InstallUserDriver (DriverPath : String; AutoDetectPtr: Pointer) : Integer;
+Function InstallUserDriver (DriverPath : String; AutoDetectPtr: Pointer) : smallint;
 
 \Description
 This routine is not supported in FPC, it is here only for compatiblity and
@@ -1212,7 +1212,7 @@ None.
 \end{function}
 \begin{function}{InstallUserFont}
 \Declaration
-Function InstallUserFont (FontPath : String) : Integer;
+Function InstallUserFont (FontPath : String) : smallint;
 
 \Description
 \var{InstallUserFont} adds the font in \var{FontPath} to the list of fonts
@@ -1225,7 +1225,7 @@ None.
 \end{function}
 \begin{procedure}{Line}
 \Declaration
-Procedure Line (X1,Y1,X2,Y2 : Integer);
+Procedure Line (X1,Y1,X2,Y2 : smallint);
 
 \Description
 \var{Line} draws a line starting from
@@ -1244,7 +1244,7 @@ None.
 \end{procedure}
 \begin{procedure}{LineRel}
 \Declaration
-Procedure LineRel (DX,DY : Integer);
+Procedure LineRel (DX,DY : smallint);
 
 \Description
 \var{LineRel} draws a line starting from
@@ -1258,7 +1258,7 @@ None.
 \end{procedure}
 \begin{procedure}{LineTo}
 \Declaration
-Procedure LineTo (DX,DY : Integer);
+Procedure LineTo (DX,DY : smallint);
 
 \Description
 \var{LineTo} draws a line starting from
@@ -1272,7 +1272,7 @@ None.
 \end{procedure}
 \begin{procedure}{MoveRel}
 \Declaration
-Procedure MoveRel (DX,DY : Integer;
+Procedure MoveRel (DX,DY : smallint;
 
 \Description
 \var{MoveRel} moves the current pointer to the
@@ -1285,7 +1285,7 @@ None.
 \end{procedure}
 \begin{procedure}{MoveTo}
 \Declaration
-Procedure MoveTo (X,Y : Integer);
+Procedure MoveTo (X,Y : smallint);
 
 \Description
 \var{MoveTo} moves the current pointer to the
@@ -1317,7 +1317,7 @@ None.
 \end{procedure}
 \begin{procedure}{OutTextXY}
 \Declaration
-Procedure OutTextXY (X,Y : Integer; Const TextString : String);
+Procedure OutTextXY (X,Y : smallint; Const TextString : String);
 
 \Description
 \var{OutText} puts \var{TextString} on the screen, at position \var{(X,Y)},
@@ -1335,7 +1335,7 @@ None.
 \end{procedure}
 \begin{procedure}{PieSlice}
 \Declaration
-Procedure PieSlice (X,Y,stangle,endAngle:integer;Radius: Word);
+Procedure PieSlice (X,Y,stangle,endAngle:smallint;Radius: Word);
 
 \Description
 \var{PieSlice}
@@ -1350,7 +1350,7 @@ None.
 \end{procedure}
 \begin{procedure}{PutImage}
 \Declaration
-Procedure PutImage (X,Y: Integer; var Bitmap; BitBlt: Word);
+Procedure PutImage (X,Y: smallint; var Bitmap; BitBlt: Word);
 
 \Description
 \var{PutImage}
@@ -1377,7 +1377,7 @@ None
 \end{procedure}
 \begin{procedure}{PutPixel}
 \Declaration
-Procedure PutPixel (X,Y : Integer; Color : Word);
+Procedure PutPixel (X,Y : smallint; Color : Word);
 
 \Description
 Puts a point at
@@ -1390,7 +1390,7 @@ None.
 \end{procedure}
 \begin{procedure}{Rectangle}
 \Declaration
-Procedure Rectangle (X1,Y1,X2,Y2 : Integer);
+Procedure Rectangle (X1,Y1,X2,Y2 : smallint);
 
 \Description
 Draws a rectangle with
@@ -1403,7 +1403,7 @@ None.
 \end{procedure}
 \begin{function}{RegisterBGIDriver}
 \Declaration
-Function RegisterBGIDriver (Driver : Pointer) : Integer;
+Function RegisterBGIDriver (Driver : Pointer) : smallint;
 
 \Description
 This routine is not supported in FPC. It is here for compatibility and it
@@ -1416,7 +1416,7 @@ None.
 \end{function}
 \begin{function}{RegisterBGIFont}
 \Declaration
-Function RegisterBGIFont (Font : Pointer) : Integer;
+Function RegisterBGIFont (Font : Pointer) : smallint;
 
 \Description
 This routine permits the user to add a font to the list of known fonts
@@ -1460,8 +1460,8 @@ Example:
 uses Graph;
 
 var
- Gd, Gm: Integer;
- Mode: Integer;
+ Gd, Gm: smallint;
+ Mode: smallint;
 begin
  Gd := Detect;
  InitGraph(Gd, Gm, ' ');
@@ -1482,7 +1482,7 @@ end.
 \end{verbatim}
 \begin{procedure}{Sector}
 \Declaration
-Procedure Sector (X,Y : Integer; StAngle,EndAngle,XRadius,YRadius : Word);
+Procedure Sector (X,Y : smallint; StAngle,EndAngle,XRadius,YRadius : Word);
 
 \Description
 \var{Sector}
@@ -1661,7 +1661,7 @@ None.
 \end{procedure}
 \begin{procedure}{SetGraphMode}
 \Declaration
-Procedure SetGraphMode (Mode : Integer);
+Procedure SetGraphMode (Mode : smallint);
 
 \Description
 \var{SetGraphMode} sets the
@@ -1738,7 +1738,7 @@ None.
 \end{procedure}
 \begin{procedure}{SetRGBPalette}
 \Declaration
-Procedure SetRGBPalette (ColorNum,Red,Green,Blue : Integer);
+Procedure SetRGBPalette (ColorNum,Red,Green,Blue : smallint);
 
 \Description
 \var{SetRGBPalette} sets the \var{ColorNum}-th entry in the palette to the
@@ -1838,7 +1838,7 @@ None.
 \end{procedure}
 \begin{procedure}{SetViewPort}
 \Declaration
-Procedure SetViewPort (X1,Y1,X2,Y2 : Integer; Clip : Boolean);
+Procedure SetViewPort (X1,Y1,X2,Y2 : smallint; Clip : Boolean);
 
 \Description
 Sets the current graphical view-port (window) to the rectangle defined by
@@ -1864,7 +1864,7 @@ None
 \end{procedure}
 \begin{procedure}{SetWriteMode}
 \Declaration
-Procedure SetWriteMode (Mode : Integer);
+Procedure SetWriteMode (Mode : smallint);
 
 \Description
 \var{SetWriteMode} controls the drawing of lines on the screen. It controls

+ 31 - 28
rtl/inc/graph/gtext.inc

@@ -43,10 +43,10 @@
       PHeader = ^THeader;
       THeader = packed record
         Signature:  char;     { signature byte                        }
-        Nr_chars:   integer;  { number of characters in file          }
+        Nr_chars:   smallint;  { number of characters in file          }
         Reserved:   byte;
         First_char: byte;     { first character in file               }
-        cdefs :     integer;  { offset to character definitions       }
+        cdefs :     smallint;  { offset to character definitions       }
         scan_flag:  byte;     { TRUE if char is scanable              }
         org_to_cap: shortint;     { Height from origin to top of capitol  }
         org_to_base:shortint;     { Height from origin to baseline        }
@@ -56,7 +56,7 @@
       end;
 
 
-      TOffsetTable =array[0..MaxChars] of Integer;
+      TOffsetTable =array[0..MaxChars] of smallint;
       TWidthTable  =array[0..MaxChars] of byte;
 
       tfontrec = packed record
@@ -74,8 +74,8 @@
       pStroke = ^TStroke;
       TStroke = packed record
         opcode: byte;
-        x: integer;  { relative x offset character }
-        y: integer;  { relative y offset character }
+        x: smallint;  { relative x offset character }
+        y: smallint;  { relative y offset character }
       end;
 
 
@@ -87,7 +87,7 @@
     var
        fonts : array[1..maxfonts] of tfontrec;
        Strokes: TStrokes; {* Stroke Data Base           *}
-       Stroke_count: Array[0..MaxChars] of integer; {* Stroke Count Table *}
+       Stroke_count: Array[0..MaxChars] of smallint; {* Stroke Count Table *}
 
 {***************************************************************************}
 {                         Internal support routines                         }
@@ -103,7 +103,7 @@
       end;
 
 
-    function InstallUserFont(const FontFileName : string) : integer;
+    function InstallUserFont(const FontFileName : string) : smallint;
 
       begin
          _graphresult:=grOk;
@@ -122,7 +122,7 @@
       end;
 
 
-    function Decode(byte1,byte2: char; var x,y: integer): integer;
+    function Decode(byte1,byte2: char; var x,y: smallint): smallint;
     { This routines decoes a signle word in a font opcode section  }
     { to a stroke record.                                          }
       var
@@ -131,7 +131,7 @@
        b1:=shortint(byte1);
        b2:=shortint(byte2);
        { Decode the CHR OPCODE }
-       Decode:=integer(((b1 and $80) shr 6)+((b2 and $80) shr 7));
+       Decode:=smallint(((b1 and $80) shr 6)+((b2 and $80) shr 7));
        { Now get the X,Y coordinates        }
        { bit 0..7 only which are considered }
        { signed values.                     }
@@ -143,23 +143,23 @@
        { sign extend it...                      }
        if (b1 and $40)<>0 then b1:=b1 or $80;
        if (b2 and $40)<>0 then b2:=b2 or $80;
-       x:=integer(b1);
-       y:=integer(b2);
+       x:=smallint(b1);
+       y:=smallint(b2);
 {$ifdef debug}
 {$R+}
 {$endif debug}
      end;
 
 
-    function unpack(buf: pchar; index: integer; var Stroke: TStrokes): integer;
+    function unpack(buf: pchar; index: smallint; var Stroke: TStrokes): smallint;
 
      var
       po: TStrokes;
-      num_ops: integer;
+      num_ops: smallint;
       opcode, i, opc: word;
-      counter: integer;
-      lindex: integer;
-      jx, jy: integer;
+      counter: smallint;
+      lindex: smallint;
+      jx, jy: smallint;
      begin
        num_ops := 0;
        counter := index;
@@ -254,7 +254,7 @@
 {***************************************************************************}
 
 
-    function RegisterBGIfont(font : pointer) : integer;
+    function RegisterBGIfont(font : pointer) : smallint;
 
       var
          hp : pchar;
@@ -283,8 +283,8 @@
                      begin
                         move(FHeader,fonts[b].PHeader,sizeof(FHeader));
                         move(Header,fonts[b].Header,sizeof(Header));
-                        move(hp[i],Fonts[b].Offsets[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(integer));
-                        Inc(i,Fonts[b].Header.Nr_chars*sizeof(integer));
+                        move(hp[i],Fonts[b].Offsets[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(smallint));
+                        Inc(i,Fonts[b].Header.Nr_chars*sizeof(smallint));
                         move(hp[i],Fonts[b].Widths[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(byte));
                         Inc(i,Fonts[b].Header.Nr_chars*sizeof(byte));
                         counter:=Fonts[b].PHeader.font_size+PREFIX_SIZE-i;
@@ -330,7 +330,7 @@
       end;
 
     function TextWidth(const TextString : string) : word;
-      var i,x : Integer;
+      var i,x : smallint;
           c   : byte;
       begin
          x := 0;
@@ -353,22 +353,22 @@
       end;
 
 
-    procedure OutTextXY(x,y : integer;const TextString : string);
+    procedure OutTextXY(x,y : smallint;const TextString : string);
 
       type
        Tpoint = record
-         X,Y: Integer;
+         X,Y: smallint;
        end;
       var
          i,j,k,c       : longint;
          xpos,ypos     : longint;
          counter       : longint;
          FontBitmap    : TBitmapChar;
-         cnt1,cnt2     : integer;
-         cnt3,cnt4     : integer;
+         cnt1,cnt2     : smallint;
+         cnt3,cnt4     : smallint;
          charsize      : word;
          WriteMode     : word;
-         CurX, CurY    : integer;
+         CurX, CurY    : smallint;
          oldvalues     : linesettingstype;
          chr           : char;
 
@@ -546,7 +546,7 @@
 
 
     procedure OutText(const TextString : string);
-      var x,y:integer;
+      var x,y:smallint;
       begin
          { Save CP }
          x:=CurrentX;
@@ -681,7 +681,7 @@
               BlockRead(F,fonts[font].Header,Sizeof(THeader));
               Base := FilePos(F);     {* Remember the address of table*}
 
-              BlockRead(F,Fonts[font].Offsets[Fonts[font].Header.First_Char],Fonts[font].Header.Nr_chars*sizeof(integer));
+              BlockRead(F,Fonts[font].Offsets[Fonts[font].Header.First_Char],Fonts[font].Header.Nr_chars*sizeof(smallint));
 
               {*        Load the character width table into memory.                     *}
 
@@ -731,7 +731,10 @@
 
 {
 $Log$
-Revision 1.8  1999-11-11 22:29:21  florian
+Revision 1.9  1999-12-20 11:22:36  peter
+  * integer -> smallint to overcome -S2 switch needed for ggi version
+
+Revision 1.8  1999/11/11 22:29:21  florian
   * the writing of the default font was wrong when doing scaling:
     the last colunm/row wasn't drawn
 

+ 11 - 8
rtl/inc/graph/modes.inc

@@ -59,7 +59,7 @@
    end;
 
 
-   function searchmode(ReqDriver : integer; reqmode: integer): PModeInfo;
+   function searchmode(ReqDriver : smallint; reqmode: smallint): PModeInfo;
   {********************************************************}
   { Procedure SearchMode()                                 }
   {--------------------------------------------------------}
@@ -104,7 +104,7 @@
 {                          External routines                            }
 {-----------------------------------------------------------------------}
 
-   function GetModeName(ModeNumber: integer): string;
+   function GetModeName(ModeNumber: smallint): string;
   {********************************************************}
   { Function GetModeName()                                 }
   {--------------------------------------------------------}
@@ -124,7 +124,7 @@
          _GraphResult := grInvalidMode;
     end;
 
-   function GetGraphMode: Integer;
+   function GetGraphMode: smallint;
      begin
       GetGraphMode := IntCurrentMode;
      end;
@@ -150,10 +150,10 @@
     end;
 
 
-    procedure GetModeRange(GraphDriver: Integer; var LoMode,
-      HiMode: Integer);
+    procedure GetModeRange(GraphDriver: smallint; var LoMode,
+      HiMode: smallint);
       var
-       i : integer;
+       i : smallint;
        mode : PModeInfo;
      begin
        {$ifdef logging}
@@ -187,7 +187,7 @@
      end;
 
 
-  procedure SetGraphMode(mode: Integer);
+  procedure SetGraphMode(mode: smallint);
     var
      modeinfo: PModeInfo;
     begin
@@ -341,7 +341,10 @@
 
 {
 $Log$
-Revision 1.14  1999-12-04 21:20:04  michael
+Revision 1.15  1999-12-20 11:22:36  peter
+  * integer -> smallint to overcome -S2 switch needed for ggi version
+
+Revision 1.14  1999/12/04 21:20:04  michael
 + Additional logging
 
 Revision 1.13  1999/11/28 16:13:55  jonas

+ 5 - 2
rtl/inc/graph/palette.inc

@@ -366,7 +366,7 @@ CONST
              Palette.Colors[i].Blue);
       end;
 
-    function GetPaletteSize: integer;
+    function GetPaletteSize: smallint;
      begin
        GetPaletteSize := PaletteSize;
      end;
@@ -382,7 +382,10 @@ CONST
 
 {
 $Log$
-Revision 1.4  1999-07-12 13:27:15  jonas
+Revision 1.5  1999-12-20 11:22:36  peter
+  * integer -> smallint to overcome -S2 switch needed for ggi version
+
+Revision 1.4  1999/07/12 13:27:15  jonas
   + added Log and Id tags
   * added first FPC support, only VGA works to some extend for now
   * use -dasmgraph to use assembler routines, otherwise Pascal