aboutsummaryrefslogtreecommitdiffstats
path: root/xtools/check_iirs.adb
blob: 3b28dfee8c183c0deaac730c5c29698549758145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--  Tool to check the coherence of the iirs package.
--  Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
--
--  GHDL 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, or (at your option) any later
--  version.
--
--  GHDL 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 GCC; see the file COPYING.  If not, write to the Free
--  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--  02111-1307, USA.
with Check_Iirs_Pkg;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;

procedure Check_Iirs
is
   type Prg_Mode is (Mode_Generate, Mode_Genfast, Mode_Free);
   Mode : Prg_Mode;
   procedure Usage is
   begin
      Put_Line ("usage: " & Command_Name & " MODE");
      Put_Line ("MODE is one of:");
      Put_Line (" --generate");
      Put_Line (" --genfast");
      Put_Line (" --list-free-fields");
   end Usage;
begin
   if Argument_Count /= 1 then
      Usage;
      Set_Exit_Status (Failure);
      return;
   end if;
   if Argument (1) = "--generate" then
      Mode := Mode_Generate;
   elsif Argument (1) = "--genfast" then
      Mode := Mode_Genfast;
   elsif Argument (1) = "--list-free-fields" then
      Mode := Mode_Free;
   else
      Usage;
      Set_Exit_Status (Failure);
      return;
   end if;

   Check_Iirs_Pkg.Read_Fields;
   Check_Iirs_Pkg.Check_Iirs;
   Check_Iirs_Pkg.Read_Desc;
   case Mode is
      when Mode_Generate =>
         Check_Iirs_Pkg.Gen_Func;
      when Mode_Genfast =>
         Check_Iirs_Pkg.Flag_Checks := False;
         Check_Iirs_Pkg.Gen_Func;
      when Mode_Free =>
         Check_Iirs_Pkg.List_Free_Fields;
   end case;
end Check_Iirs;