From 44e1fbf53dcf4718b197506a9a625c19b6baf924 Mon Sep 17 00:00:00 2001
From: Tristan Gingold <tgingold@free.fr>
Date: Wed, 5 Nov 2014 20:53:35 +0100
Subject: ghdldrv: reflect --disp-config changes for ghdl_mcode.

---
 src/ghdldrv/ghdlcomp.adb  | 24 ++++--------------------
 src/ghdldrv/ghdldrv.adb   | 28 +---------------------------
 src/ghdldrv/ghdllocal.adb | 34 ++++++++++++++++++++++++++++++++++
 src/ghdldrv/ghdllocal.ads |  3 +++
 4 files changed, 42 insertions(+), 47 deletions(-)

(limited to 'src')

diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb
index ba755af8a..ef81487af 100644
--- a/src/ghdldrv/ghdlcomp.adb
+++ b/src/ghdldrv/ghdlcomp.adb
@@ -34,7 +34,6 @@ with Libraries;
 with Std_Package;
 with Files_Map;
 with Version;
-with Default_Pathes;
 
 package body Ghdlcomp is
 
@@ -451,14 +450,14 @@ package body Ghdlcomp is
    is
       pragma Unreferenced (Cmd);
    begin
-      return Name = "--dispconfig";
+      return Name = "--dispconfig" or else Name = "--disp-config";
    end Decode_Command;
 
    function Get_Short_Help (Cmd : Command_Dispconfig) return String
    is
       pragma Unreferenced (Cmd);
    begin
-      return "--dispconfig       Disp tools path";
+      return "--disp-config      Disp tools path";
    end Get_Short_Help;
 
    procedure Perform_Action (Cmd : in out Command_Dispconfig;
@@ -469,27 +468,12 @@ package body Ghdlcomp is
       pragma Unreferenced (Cmd);
    begin
       if Args'Length /= 0 then
-         Error ("--dispconfig does not accept any argument");
+         Error ("--disp-config does not accept any argument");
          raise Errorout.Option_Error;
       end if;
 
-      Put ("command line prefix (--PREFIX): ");
-      if Prefix_Path = null then
-         Put_Line ("(not set)");
-      else
-         Put_Line (Prefix_Path.all);
-      end if;
-      Setup_Libraries (False);
-
-      Put ("environment prefix (GHDL_PREFIX): ");
-      if Prefix_Env = null then
-         Put_Line ("(not set)");
-      else
-         Put_Line (Prefix_Env.all);
-      end if;
+      Disp_Config_Prefixes;
 
-      Put_Line ("default prefix: " & Default_Pathes.Prefix);
-      Put_Line ("actual prefix: " & Prefix_Path.all);
       Put_Line ("command_name: " & Ada.Command_Line.Command_Name);
       Put_Line ("default library pathes:");
       for I in 2 .. Get_Nbr_Pathes loop
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index be905f1af..1eab18d49 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -801,34 +801,8 @@ package body Ghdldrv is
 
       New_Line;
 
-      Put ("command line prefix (--PREFIX): ");
-      if Switch_Prefix_Path = null then
-         Put_Line ("(not set)");
-      else
-         Put_Line (Switch_Prefix_Path.all);
-      end if;
-
-      Put ("environment prefix (GHDL_PREFIX): ");
-      if Prefix_Env = null then
-         Put_Line ("(not set)");
-      else
-         Put_Line (Prefix_Env.all);
-      end if;
-
-      Setup_Libraries (False);
-
-      Put ("exec prefix (from program name): ");
-      if Exec_Prefix = null then
-         Put_Line ("(not found)");
-      else
-         Put_Line (Exec_Prefix.all);
-      end if;
-
-      New_Line;
+      Disp_Config_Prefixes;
 
-      Put_Line ("library prefix: " & Lib_Prefix_Path.all);
-      Put ("library directory: ");
-      Put_Line (Get_Machine_Path_Prefix);
       Locate_Tools;
       Put ("compiler path: ");
       Put_Line (Compiler_Path.all);
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index a1d94bd77..ce061e27b 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -418,6 +418,40 @@ package body Ghdllocal is
       end if;
    end Setup_Libraries;
 
+   procedure Disp_Config_Prefixes
+   is
+      use Ada.Text_IO;
+   begin
+      Put ("command line prefix (--PREFIX): ");
+      if Switch_Prefix_Path = null then
+         Put_Line ("(not set)");
+      else
+         Put_Line (Switch_Prefix_Path.all);
+      end if;
+
+      Put ("environment prefix (GHDL_PREFIX): ");
+      if Prefix_Env = null then
+         Put_Line ("(not set)");
+      else
+         Put_Line (Prefix_Env.all);
+      end if;
+
+      Setup_Libraries (False);
+
+      Put ("exec prefix (from program name): ");
+      if Exec_Prefix = null then
+         Put_Line ("(not found)");
+      else
+         Put_Line (Exec_Prefix.all);
+      end if;
+
+      New_Line;
+
+      Put_Line ("library prefix: " & Lib_Prefix_Path.all);
+      Put ("library directory: ");
+      Put_Line (Get_Machine_Path_Prefix);
+   end Disp_Config_Prefixes;
+
    procedure Disp_Library_Unit (Unit : Iir)
    is
       use Ada.Text_IO;
diff --git a/src/ghdldrv/ghdllocal.ads b/src/ghdldrv/ghdllocal.ads
index 2c7018adc..d64846f78 100644
--- a/src/ghdldrv/ghdllocal.ads
+++ b/src/ghdldrv/ghdllocal.ads
@@ -90,6 +90,9 @@ package Ghdllocal is
    -- Get Prefix_Path, but with 32 added if -m32 is requested
    function Get_Machine_Path_Prefix return String;
 
+   --  Subprocedure for --disp-config: display prefixes.
+   procedure Disp_Config_Prefixes;
+
    --  Setup standard libaries path.  If LOAD is true, then load them now.
    procedure Setup_Libraries (Load : Boolean);
 
-- 
cgit v1.2.3