-----------------------------------------------------------------------
--                               G P S                               --
--                                                                   --
--                 Copyright (C) 2006-2009, AdaCore                  --
--                                                                   --
-- GPS is free  software;  you can redistribute it and/or modify  it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version.                               --
--                                                                   --
-- This program 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 --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not,  write to the  Free Software Foundation, Inc.,  59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
-----------------------------------------------------------------------

--  This package holds some generic commands that could be used widely in GPS.

package GPS.Kernel.Commands is

   type File_Callback is access procedure
     (Kernel : access Kernel_Handle_Record'Class;
      File   : GNATCOLL.VFS.Virtual_File);

   procedure Do_On_Each_File
     (Handle            : access Kernel_Handle_Record'Class;
      Callback          : File_Callback;
      Chunk_Size        : Positive := 1;
      Queue_Name        : String := "";
      Operation_Name    : String := "";
      Files             : File_Array_Access := null);
   --  This procedure will launch a GPS command wich will call the given
   --  callback sequentially on each file given in parameter It's possible to
   --  change the number of files analyzed per iteration by modifiying the
   --  Chunk_Size parameter. Queue_Base_Name is used to give the basename of
   --  the queue. If Files is null, then all files of the registry will be
   --  used, otherwise, only the argument given in parameter will be. The file
   --  array will be freed by the command at the end of the process.

   procedure Kill_File_Iteration
     (Kernel : access Kernel_Handle_Record'Class; Queue_Name : String);
   --  Kills the queue deduced from the base name given in parameter, assuming
   --  that these queues have been made for a file iteration from
   --  Do_On_Each_File.

end GPS.Kernel.Commands;
