1. -- 
  2. --  Copyright (c) 2008-2009, 
  3. --  Reto Buerki, Adrian-Ken Rueegsegger 
  4. --  secunet SwissIT AG 
  5. -- 
  6. --  This file is part of Alog. 
  7. -- 
  8. --  Alog is free software; you can redistribute it and/or modify 
  9. --  it under the terms of the GNU Lesser General Public License as published 
  10. --  by the Free Software Foundation; either version 2.1 of the License, or 
  11. --  (at your option) any later version. 
  12. -- 
  13. --  Alog is distributed in the hope that it will be useful, 
  14. --  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  15. --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  16. --  GNU Lesser General Public License for more details. 
  17. -- 
  18. --  You should have received a copy of the GNU Lesser General Public License 
  19. --  along with Alog; if not, write to the Free Software 
  20. --  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
  21. --  MA  02110-1301  USA 
  22. -- 
  23.  
  24. with Ada.Direct_IO; 
  25.  
  26. with Alog.Maps; 
  27.  
  28. --  Alog helper functions/procedures. 
  29. package Alog.Helpers is 
  30.  
  31.    function Assert_Files_Equal 
  32.      (Filename1 : String; 
  33.       Filename2 : String) 
  34.       return Boolean; 
  35.    --  Compare two files byte-wise. Returns True if both files are equal. 
  36.    --  The two files are closed but not removed after comparison. 
  37.  
  38.    procedure Read_Loglevels 
  39.      (Filename      :        String; 
  40.       Default_Level : in out Log_Level; 
  41.       Identifiers   :    out Maps.Wildcard_Level_Map); 
  42.    --  Read default loglevels and (optional) identifier based loglevels from 
  43.    --  file given by filename. The format is as follows: 
  44.    -- 
  45.    --  # This is a comment (ignored) 
  46.    -- 
  47.    --  # Default loglevel 
  48.    --  Default = Info 
  49.    -- 
  50.    --  # Identifier-specific loglevels 
  51.    --  Foo.* = Debug 
  52.    --  Foo.Bar = Info 
  53.    -- 
  54.    --  If no default loglevel setting is found in the file, the loglevel passed 
  55.    --  as Default_Level parameter is returned unchanged. 
  56.  
  57.    Invalid_Config : exception; 
  58.    --  Exception is raised if a loglevel config file is invalid. 
  59.  
  60. private 
  61.    type My_Rec is record 
  62.       Char : Character; 
  63.    end record; 
  64.  
  65.    package D_IO is new Ada.Direct_IO (My_Rec); 
  66.    use D_IO; 
  67.  
  68. end Alog.Helpers;