Skip to content

Commit 2408f13

Browse files
committed
Replace by Virtual_String
1 parent d80e442 commit 2408f13

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

help/src/help_module.adb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2001-2024, AdaCore --
4+
-- Copyright (C) 2001-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -948,14 +948,18 @@ package body Help_Module is
948948
begin
949949
Set_Unbounded_String
950950
(About_Text,
951-
"GNAT Studio " & To_String (Config.Version)
952-
& " (" & Config.Source_Date
953-
& (-") hosted on ") & Config.Target & LF
954-
& (-"GNAT ") & GNAT_Version (Kernel)
955-
& (if Compiler_Target /= "" then
956-
" targeting " & Compiler_Target
957-
else
958-
""));
951+
"GNAT Studio "
952+
& To_String (Config.Version)
953+
& " ("
954+
& Config.Source_Date
955+
& (-") hosted on ")
956+
& Config.Target
957+
& LF
958+
& (-"GNAT ")
959+
& VSS.Strings.Conversions.To_UTF_8_String (Kernel.GNAT_Version)
960+
& (if Compiler_Target /= ""
961+
then " targeting " & Compiler_Target
962+
else ""));
959963
end;
960964

961965
-- Display the version used by CodePeer and SPARK, if found in the

kernel/src/gps-kernel-project.adb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2001-2024, AdaCore --
4+
-- Copyright (C) 2001-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -20,18 +20,18 @@ with Ada.Containers.Indefinite_Hashed_Maps;
2020
with Ada.Strings.Hash;
2121
with Ada.Strings.Fixed;
2222
with Ada.Unchecked_Deallocation;
23+
with GNAT.OS_Lib; use GNAT.OS_Lib;
24+
pragma Warnings (Off, ".*is an internal GNAT unit");
25+
with GNAT.Expect.TTY.Remote; use GNAT.Expect.TTY.Remote;
26+
pragma Warnings (On, ".*is an internal GNAT unit");
2327

24-
with VSS.Strings;
28+
with VSS.Strings.Conversions;
2529

2630
with GNATCOLL.JSON;
2731
with GNATCOLL.Projects; use GNATCOLL.Projects;
2832
with GNATCOLL.Traces; use GNATCOLL.Traces;
2933
with GNATCOLL.Utils; use GNATCOLL.Utils;
3034
with GNATCOLL.VFS; use GNATCOLL.VFS;
31-
with GNAT.OS_Lib; use GNAT.OS_Lib;
32-
pragma Warnings (Off, ".*is an internal GNAT unit");
33-
with GNAT.Expect.TTY.Remote; use GNAT.Expect.TTY.Remote;
34-
pragma Warnings (On, ".*is an internal GNAT unit");
3535

3636
with Projects; use Projects;
3737
with Remote; use Remote;
@@ -280,7 +280,8 @@ package body GPS.Kernel.Project is
280280
(Self : in out GPS_Project_Environment;
281281
Version : String) is
282282
begin
283-
Self.Kernel.GNAT_Version := To_Unbounded_String (Version);
283+
Self.Kernel.GNAT_Version_Cache :=
284+
VSS.Strings.Conversions.To_Virtual_String (Version);
284285
end Set_GNAT_Version;
285286

286287
------------------

kernel/src/gps-kernel.adb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,12 @@ package body GPS.Kernel is
289289
------------------
290290

291291
function GNAT_Version
292-
(Handle : access Kernel_Handle_Record) return String is
292+
(Handle : access Kernel_Handle_Record)
293+
return VSS.Strings.Virtual_String is
293294
begin
294-
if Handle.GNAT_Version = Null_Unbounded_String then
295-
return -"<unknown version>";
296-
else
297-
return To_String (Handle.GNAT_Version);
298-
end if;
295+
return
296+
(if Handle.GNAT_Version_Cache.Is_Empty
297+
then -"<unknown version>" else Handle.GNAT_Version_Cache);
299298
end GNAT_Version;
300299

301300
-----------------------
@@ -306,7 +305,8 @@ package body GPS.Kernel is
306305
(Handle : access Kernel_Handle_Record;
307306
Date : Date_Type) return Boolean
308307
is
309-
Version : constant String := GNAT_Version (Handle);
308+
Version : constant String :=
309+
VSS.Strings.Conversions.To_UTF_8_String (Handle.GNAT_Version_Cache);
310310
Open_Index : constant Natural := Index (Version, "(");
311311
Close_Index : Natural;
312312
Compiler_Date : Date_Type;

kernel/src/gps-kernel.ads

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2001-2023, AdaCore --
4+
-- Copyright (C) 2001-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -26,17 +26,19 @@ with Ada.Strings.Hash;
2626
with Ada.Strings.Hash_Case_Insensitive;
2727
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
2828
with Ada.Unchecked_Deallocation;
29+
with GNAT.Regpat;
30+
with GNAT.Strings;
2931
with System;
3032

31-
with GNAT.Strings;
3233
with GNATCOLL.Projects;
33-
with GNAT.Regpat;
3434
with GNATCOLL.Refcount;
3535
with GNATCOLL.Scripts;
3636
with GNATCOLL.Traces;
3737
with GNATCOLL.Tribooleans;
3838
with GNATCOLL.VFS; use GNATCOLL.VFS;
3939

40+
with VSS.Strings;
41+
4042
with Glib.Main;
4143
with Glib; use Glib;
4244
with Glib.Object;
@@ -227,7 +229,7 @@ package GPS.Kernel is
227229
-- Return the language handler used by this kernel
228230

229231
function GNAT_Version
230-
(Handle : access Kernel_Handle_Record) return String;
232+
(Handle : access Kernel_Handle_Record) return VSS.Strings.Virtual_String;
231233
-- Return a string containing the GNAT version number.
232234
-- The string has the form "Pro 6.4.0w (20100727-43)"
233235
-- See also Require_GNAT_Date below.
@@ -1240,7 +1242,7 @@ private
12401242
-- but this gets invalid early when GNAT Studio exists, and we no
12411243
-- longer have access to the main window while destroying its children
12421244

1243-
GNAT_Version : Unbounded_String;
1245+
GNAT_Version_Cache : VSS.Strings.Virtual_String;
12441246
-- Full GNAT Version, if relevant
12451247

12461248
Preferences : Default_Preferences.Preferences_Manager;

0 commit comments

Comments
 (0)