--------------------------------------------------------------------------------
--                                                                            --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers.               --
--                                                                            --
-- This library is free software; you can redistribute it and/or              --
-- modify it under the terms of the GNU Lesser General Public                 --
-- License as published by the Free Software Foundation; either               --
-- version 2.1 of the License, or (at your option) any later version.         --
--                                                                            --
-- This library is distributed in the hope that it will be useful,            --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of             --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           --
-- Lesser General Public License for more details.                            --
--                                                                            --
-- You should have received a copy of the GNU Lesser General Public           --
-- License along with this library; if not, write to the Free Software        --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    --
--                                                                            --
--------------------------------------------------------------------------------

-- $Author$
-- $Date$
-- $Revision$

with RASCAL.OS;       use RASCAL.OS;
with RASCAL.Utility;  use RASCAL.Utility;
                      
with Interfaces.C;    use Interfaces.C;
with Kernel;          use Kernel;


package body RASCAL.Plot is

   OS_Plot : constant := 16#45#;

   --

   procedure Plot (Plot_Code : in Integer;
                   X         : in Integer;
                   Y         : in Integer) is

      Error      : Kernel.OSError_Access;
      Register   : aliased Kernel.swi_regs;
   begin
      Register.R(0) := Int(Plot_Code);
      Register.R(1) := Int(X);
      Register.R(2) := Int(Y);
      
      Error := Kernel.SWI (OS_Plot,Register'access,Register'access);

      if Error /= null then
         pragma Debug(Report ("Plot.Plot : " & To_Ada (Error.errmess)));
         OS.Raise_Error(Error);
      end if;
   end Plot;

   --

end RASCAL.Plot;