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