1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Ada
.Strings
.Wide_Fixed
;
33 with Ada
.Strings
.Wide_Search
;
34 with Ada
.Unchecked_Deallocation
;
36 package body Ada
.Strings
.Wide_Unbounded
is
43 (Left
: Unbounded_Wide_String
;
44 Right
: Unbounded_Wide_String
) return Unbounded_Wide_String
46 L_Length
: constant Natural := Left
.Last
;
47 R_Length
: constant Natural := Right
.Last
;
48 Result
: Unbounded_Wide_String
;
51 Result
.Last
:= L_Length
+ R_Length
;
53 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
55 Result
.Reference
(1 .. L_Length
) :=
56 Left
.Reference
(1 .. Left
.Last
);
57 Result
.Reference
(L_Length
+ 1 .. Result
.Last
) :=
58 Right
.Reference
(1 .. Right
.Last
);
64 (Left
: Unbounded_Wide_String
;
65 Right
: Wide_String) return Unbounded_Wide_String
67 L_Length
: constant Natural := Left
.Last
;
68 Result
: Unbounded_Wide_String
;
71 Result
.Last
:= L_Length
+ Right
'Length;
73 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
75 Result
.Reference
(1 .. L_Length
) := Left
.Reference
(1 .. Left
.Last
);
76 Result
.Reference
(L_Length
+ 1 .. Result
.Last
) := Right
;
83 Right
: Unbounded_Wide_String
) return Unbounded_Wide_String
85 R_Length
: constant Natural := Right
.Last
;
86 Result
: Unbounded_Wide_String
;
89 Result
.Last
:= Left
'Length + R_Length
;
91 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
93 Result
.Reference
(1 .. Left
'Length) := Left
;
94 Result
.Reference
(Left
'Length + 1 .. Result
.Last
) :=
95 Right
.Reference
(1 .. Right
.Last
);
101 (Left
: Unbounded_Wide_String
;
102 Right
: Wide_Character) return Unbounded_Wide_String
104 Result
: Unbounded_Wide_String
;
107 Result
.Last
:= Left
.Last
+ 1;
109 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
111 Result
.Reference
(1 .. Result
.Last
- 1) :=
112 Left
.Reference
(1 .. Left
.Last
);
113 Result
.Reference
(Result
.Last
) := Right
;
119 (Left
: Wide_Character;
120 Right
: Unbounded_Wide_String
) return Unbounded_Wide_String
122 Result
: Unbounded_Wide_String
;
125 Result
.Last
:= Right
.Last
+ 1;
127 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
128 Result
.Reference
(1) := Left
;
129 Result
.Reference
(2 .. Result
.Last
) :=
130 Right
.Reference
(1 .. Right
.Last
);
140 Right
: Wide_Character) return Unbounded_Wide_String
142 Result
: Unbounded_Wide_String
;
147 Result
.Reference
:= new Wide_String (1 .. Left
);
148 for J
in Result
.Reference
'Range loop
149 Result
.Reference
(J
) := Right
;
157 Right
: Wide_String) return Unbounded_Wide_String
159 Len
: constant Natural := Right
'Length;
161 Result
: Unbounded_Wide_String
;
164 Result
.Last
:= Left
* Len
;
166 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
169 for J
in 1 .. Left
loop
170 Result
.Reference
(K
.. K
+ Len
- 1) := Right
;
179 Right
: Unbounded_Wide_String
) return Unbounded_Wide_String
181 Len
: constant Natural := Right
.Last
;
183 Result
: Unbounded_Wide_String
;
186 Result
.Last
:= Left
* Len
;
188 Result
.Reference
:= new Wide_String (1 .. Result
.Last
);
191 for J
in 1 .. Left
loop
192 Result
.Reference
(K
.. K
+ Len
- 1) :=
193 Right
.Reference
(1 .. Right
.Last
);
205 (Left
: Unbounded_Wide_String
;
206 Right
: Unbounded_Wide_String
) return Boolean
210 Left
.Reference
(1 .. Left
.Last
) < Right
.Reference
(1 .. Right
.Last
);
214 (Left
: Unbounded_Wide_String
;
215 Right
: Wide_String) return Boolean
218 return Left
.Reference
(1 .. Left
.Last
) < Right
;
223 Right
: Unbounded_Wide_String
) return Boolean
226 return Left
< Right
.Reference
(1 .. Right
.Last
);
234 (Left
: Unbounded_Wide_String
;
235 Right
: Unbounded_Wide_String
) return Boolean
239 Left
.Reference
(1 .. Left
.Last
) <= Right
.Reference
(1 .. Right
.Last
);
243 (Left
: Unbounded_Wide_String
;
244 Right
: Wide_String) return Boolean
247 return Left
.Reference
(1 .. Left
.Last
) <= Right
;
252 Right
: Unbounded_Wide_String
) return Boolean
255 return Left
<= Right
.Reference
(1 .. Right
.Last
);
263 (Left
: Unbounded_Wide_String
;
264 Right
: Unbounded_Wide_String
) return Boolean
268 Left
.Reference
(1 .. Left
.Last
) = Right
.Reference
(1 .. Right
.Last
);
272 (Left
: Unbounded_Wide_String
;
273 Right
: Wide_String) return Boolean
276 return Left
.Reference
(1 .. Left
.Last
) = Right
;
281 Right
: Unbounded_Wide_String
) return Boolean
284 return Left
= Right
.Reference
(1 .. Right
.Last
);
292 (Left
: Unbounded_Wide_String
;
293 Right
: Unbounded_Wide_String
) return Boolean
297 Left
.Reference
(1 .. Left
.Last
) > Right
.Reference
(1 .. Right
.Last
);
301 (Left
: Unbounded_Wide_String
;
302 Right
: Wide_String) return Boolean
305 return Left
.Reference
(1 .. Left
.Last
) > Right
;
310 Right
: Unbounded_Wide_String
) return Boolean
313 return Left
> Right
.Reference
(1 .. Right
.Last
);
321 (Left
: Unbounded_Wide_String
;
322 Right
: Unbounded_Wide_String
) return Boolean
326 Left
.Reference
(1 .. Left
.Last
) >= Right
.Reference
(1 .. Right
.Last
);
330 (Left
: Unbounded_Wide_String
;
331 Right
: Wide_String) return Boolean
334 return Left
.Reference
(1 .. Left
.Last
) >= Right
;
339 Right
: Unbounded_Wide_String
) return Boolean
342 return Left
>= Right
.Reference
(1 .. Right
.Last
);
349 procedure Adjust
(Object
: in out Unbounded_Wide_String
) is
351 -- Copy string, except we do not copy the statically allocated null
352 -- string, since it can never be deallocated. Note that we do not copy
353 -- extra string room here to avoid dragging unused allocated memory.
355 if Object
.Reference
/= Null_Wide_String
'Access then
357 new Wide_String'(Object.Reference (1 .. Object.Last));
366 (Source : in out Unbounded_Wide_String;
367 New_Item : Unbounded_Wide_String)
370 Realloc_For_Chunk (Source, New_Item.Last);
371 Source.Reference (Source.Last + 1 .. Source.Last + New_Item.Last) :=
372 New_Item.Reference (1 .. New_Item.Last);
373 Source.Last := Source.Last + New_Item.Last;
377 (Source : in out Unbounded_Wide_String;
378 New_Item : Wide_String)
381 Realloc_For_Chunk (Source, New_Item'Length);
382 Source.Reference (Source.Last + 1 .. Source.Last + New_Item'Length) :=
384 Source.Last := Source.Last + New_Item'Length;
388 (Source : in out Unbounded_Wide_String;
389 New_Item : Wide_Character)
392 Realloc_For_Chunk (Source, 1);
393 Source.Reference (Source.Last + 1) := New_Item;
394 Source.Last := Source.Last + 1;
402 (Source : Unbounded_Wide_String;
403 Pattern : Wide_String;
404 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
410 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
414 (Source : Unbounded_Wide_String;
415 Pattern : Wide_String;
416 Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
421 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
425 (Source : Unbounded_Wide_String;
426 Set : Wide_Maps.Wide_Character_Set) return Natural
431 (Source.Reference (1 .. Source.Last), Set);
439 (Source : Unbounded_Wide_String;
441 Through : Natural) return Unbounded_Wide_String
445 To_Unbounded_Wide_String
447 (Source.Reference (1 .. Source.Last), From, Through));
451 (Source : in out Unbounded_Wide_String;
456 if From > Through then
459 elsif From < Source.Reference'First or else Through > Source.Last then
464 Len : constant Natural := Through - From + 1;
467 Source.Reference (From .. Source.Last - Len) :=
468 Source.Reference (Through + 1 .. Source.Last);
469 Source.Last := Source.Last - Len;
479 (Source : Unbounded_Wide_String;
480 Index : Positive) return Wide_Character
483 if Index <= Source.Last then
484 return Source.Reference (Index);
486 raise Strings.Index_Error;
494 procedure Finalize (Object : in out Unbounded_Wide_String) is
495 procedure Deallocate is
496 new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
499 -- Note: Don't try to free statically allocated null string
501 if Object.Reference /= Null_Wide_String'Access then
502 Deallocate (Object.Reference);
503 Object.Reference := Null_Unbounded_Wide_String.Reference;
513 (Source : Unbounded_Wide_String;
514 Set : Wide_Maps.Wide_Character_Set;
516 Test : Strings.Membership;
517 First : out Positive;
521 Wide_Search.Find_Token
522 (Source.Reference (From .. Source.Last), Set, Test, First, Last);
526 (Source : Unbounded_Wide_String;
527 Set : Wide_Maps.Wide_Character_Set;
528 Test : Strings.Membership;
529 First : out Positive;
533 Wide_Search.Find_Token
534 (Source.Reference (1 .. Source.Last), Set, Test, First, Last);
541 procedure Free (X : in out Wide_String_Access) is
542 procedure Deallocate is
543 new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
546 -- Note: Do not try to free statically allocated null string
548 if X /= Null_Unbounded_Wide_String.Reference then
558 (Source : Unbounded_Wide_String;
560 Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
563 return To_Unbounded_Wide_String
564 (Wide_Fixed.Head (Source.Reference (1 .. Source.Last), Count, Pad));
568 (Source : in out Unbounded_Wide_String;
570 Pad : Wide_Character := Wide_Space)
572 Old : Wide_String_Access := Source.Reference;
576 (Wide_Fixed
.Head
(Source
.Reference
(1 .. Source
.Last
), Count
, Pad
));
577 Source
.Last
:= Source
.Reference
'Length;
586 (Source
: Unbounded_Wide_String
;
587 Pattern
: Wide_String;
588 Going
: Strings
.Direction
:= Strings
.Forward
;
589 Mapping
: Wide_Maps
.Wide_Character_Mapping
:= Wide_Maps
.Identity
)
595 (Source
.Reference
(1 .. Source
.Last
), Pattern
, Going
, Mapping
);
599 (Source
: Unbounded_Wide_String
;
600 Pattern
: Wide_String;
601 Going
: Direction
:= Forward
;
602 Mapping
: Wide_Maps
.Wide_Character_Mapping_Function
) return Natural
607 (Source
.Reference
(1 .. Source
.Last
), Pattern
, Going
, Mapping
);
611 (Source
: Unbounded_Wide_String
;
612 Set
: Wide_Maps
.Wide_Character_Set
;
613 Test
: Strings
.Membership
:= Strings
.Inside
;
614 Going
: Strings
.Direction
:= Strings
.Forward
) return Natural
617 return Wide_Search
.Index
618 (Source
.Reference
(1 .. Source
.Last
), Set
, Test
, Going
);
622 (Source
: Unbounded_Wide_String
;
623 Pattern
: Wide_String;
625 Going
: Direction
:= Forward
;
626 Mapping
: Wide_Maps
.Wide_Character_Mapping
:= Wide_Maps
.Identity
)
632 (Source
.Reference
(1 .. Source
.Last
), Pattern
, From
, Going
, Mapping
);
636 (Source
: Unbounded_Wide_String
;
637 Pattern
: Wide_String;
639 Going
: Direction
:= Forward
;
640 Mapping
: Wide_Maps
.Wide_Character_Mapping_Function
) return Natural
645 (Source
.Reference
(1 .. Source
.Last
), Pattern
, From
, Going
, Mapping
);
649 (Source
: Unbounded_Wide_String
;
650 Set
: Wide_Maps
.Wide_Character_Set
;
652 Test
: Membership
:= Inside
;
653 Going
: Direction
:= Forward
) return Natural
658 (Source
.Reference
(1 .. Source
.Last
), Set
, From
, Test
, Going
);
661 function Index_Non_Blank
662 (Source
: Unbounded_Wide_String
;
663 Going
: Strings
.Direction
:= Strings
.Forward
) return Natural
667 Wide_Search
.Index_Non_Blank
668 (Source
.Reference
(1 .. Source
.Last
), Going
);
671 function Index_Non_Blank
672 (Source
: Unbounded_Wide_String
;
674 Going
: Direction
:= Forward
) return Natural
678 Wide_Search
.Index_Non_Blank
679 (Source
.Reference
(1 .. Source
.Last
), From
, Going
);
686 procedure Initialize
(Object
: in out Unbounded_Wide_String
) is
688 Object
.Reference
:= Null_Unbounded_Wide_String
.Reference
;
697 (Source
: Unbounded_Wide_String
;
699 New_Item
: Wide_String) return Unbounded_Wide_String
703 To_Unbounded_Wide_String
705 (Source
.Reference
(1 .. Source
.Last
), Before
, New_Item
));
709 (Source
: in out Unbounded_Wide_String
;
711 New_Item
: Wide_String)
714 if Before
not in Source
.Reference
'First .. Source
.Last
+ 1 then
718 Realloc_For_Chunk
(Source
, New_Item
'Length);
721 (Before
+ New_Item
'Length .. Source
.Last
+ New_Item
'Length) :=
722 Source
.Reference
(Before
.. Source
.Last
);
724 Source
.Reference
(Before
.. Before
+ New_Item
'Length - 1) := New_Item
;
725 Source
.Last
:= Source
.Last
+ New_Item
'Length;
732 function Length
(Source
: Unbounded_Wide_String
) return Natural is
742 (Source
: Unbounded_Wide_String
;
744 New_Item
: Wide_String) return Unbounded_Wide_String
748 To_Unbounded_Wide_String
749 (Wide_Fixed
.Overwrite
750 (Source
.Reference
(1 .. Source
.Last
), Position
, New_Item
));
754 (Source
: in out Unbounded_Wide_String
;
756 New_Item
: Wide_String)
758 NL
: constant Natural := New_Item
'Length;
760 if Position
<= Source
.Last
- NL
+ 1 then
761 Source
.Reference
(Position
.. Position
+ NL
- 1) := New_Item
;
764 Old
: Wide_String_Access
:= Source
.Reference
;
766 Source
.Reference
:= new Wide_String'
767 (Wide_Fixed.Overwrite
768 (Source.Reference (1 .. Source.Last), Position, New_Item));
769 Source.Last := Source.Reference'Length;
775 -----------------------
776 -- Realloc_For_Chunk --
777 -----------------------
779 procedure Realloc_For_Chunk
780 (Source : in out Unbounded_Wide_String;
781 Chunk_Size : Natural)
783 Growth_Factor : constant := 32;
784 -- The growth factor controls how much extra space is allocated when
785 -- we have to increase the size of an allocated unbounded string. By
786 -- allocating extra space, we avoid the need to reallocate on every
787 -- append, particularly important when a string is built up by repeated
788 -- append operations of small pieces. This is expressed as a factor so
789 -- 32 means add 1/32 of the length of the string as growth space.
791 Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
792 -- Allocation will be done by a multiple of Min_Mul_Alloc This causes
793 -- no memory loss as most (all?) malloc implementations are obliged to
794 -- align the returned memory on the maximum alignment as malloc does not
795 -- know the target alignment.
797 S_Length : constant Natural := Source.Reference'Length;
800 if Chunk_Size > S_Length - Source.Last then
802 New_Size : constant Positive :=
803 S_Length + Chunk_Size + (S_Length / Growth_Factor);
805 New_Rounded_Up_Size : constant Positive :=
806 ((New_Size - 1) / Min_Mul_Alloc + 1) * Min_Mul_Alloc;
808 Tmp : constant Wide_String_Access :=
809 new Wide_String (1 .. New_Rounded_Up_Size);
812 Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
813 Free (Source.Reference);
814 Source.Reference := Tmp;
817 end Realloc_For_Chunk;
819 ---------------------
820 -- Replace_Element --
821 ---------------------
823 procedure Replace_Element
824 (Source : in out Unbounded_Wide_String;
829 if Index <= Source.Last then
830 Source.Reference (Index) := By;
832 raise Strings.Index_Error;
840 function Replace_Slice
841 (Source : Unbounded_Wide_String;
844 By : Wide_String) return Unbounded_Wide_String
847 return To_Unbounded_Wide_String
848 (Wide_Fixed.Replace_Slice
849 (Source.Reference (1 .. Source.Last), Low, High, By));
852 procedure Replace_Slice
853 (Source : in out Unbounded_Wide_String;
858 Old : Wide_String_Access := Source.Reference;
860 Source.Reference := new Wide_String'
861 (Wide_Fixed
.Replace_Slice
862 (Source
.Reference
(1 .. Source
.Last
), Low
, High
, By
));
863 Source
.Last
:= Source
.Reference
'Length;
867 -------------------------------
868 -- Set_Unbounded_Wide_String --
869 -------------------------------
871 procedure Set_Unbounded_Wide_String
872 (Target
: out Unbounded_Wide_String
;
873 Source
: Wide_String)
876 Target
.Last
:= Source
'Length;
877 Target
.Reference
:= new Wide_String (1 .. Source
'Length);
878 Target
.Reference
.all := Source
;
879 end Set_Unbounded_Wide_String
;
886 (Source
: Unbounded_Wide_String
;
888 High
: Natural) return Wide_String
891 -- Note: test of High > Length is in accordance with AI95-00128
893 if Low
> Source
.Last
+ 1 or else High
> Source
.Last
then
896 return Source
.Reference
(Low
.. High
);
905 (Source
: Unbounded_Wide_String
;
907 Pad
: Wide_Character := Wide_Space
) return Unbounded_Wide_String
is
909 return To_Unbounded_Wide_String
910 (Wide_Fixed
.Tail
(Source
.Reference
(1 .. Source
.Last
), Count
, Pad
));
914 (Source
: in out Unbounded_Wide_String
;
916 Pad
: Wide_Character := Wide_Space
)
918 Old
: Wide_String_Access
:= Source
.Reference
;
920 Source
.Reference
:= new Wide_String'
921 (Wide_Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
922 Source.Last := Source.Reference'Length;
926 ------------------------------
927 -- To_Unbounded_Wide_String --
928 ------------------------------
930 function To_Unbounded_Wide_String
931 (Source : Wide_String)
932 return Unbounded_Wide_String
934 Result : Unbounded_Wide_String;
936 Result.Last := Source'Length;
937 Result.Reference := new Wide_String (1 .. Source'Length);
938 Result.Reference.all := Source;
940 end To_Unbounded_Wide_String;
942 function To_Unbounded_Wide_String
943 (Length : Natural) return Unbounded_Wide_String
945 Result : Unbounded_Wide_String;
947 Result.Last := Length;
948 Result.Reference := new Wide_String (1 .. Length);
950 end To_Unbounded_Wide_String;
956 function To_Wide_String
957 (Source : Unbounded_Wide_String)
961 return Source.Reference (1 .. Source.Last);
969 (Source : Unbounded_Wide_String;
970 Mapping : Wide_Maps.Wide_Character_Mapping)
971 return Unbounded_Wide_String
975 To_Unbounded_Wide_String
976 (Wide_Fixed.Translate
977 (Source.Reference (1 .. Source.Last), Mapping));
981 (Source : in out Unbounded_Wide_String;
982 Mapping : Wide_Maps.Wide_Character_Mapping)
985 Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
989 (Source : Unbounded_Wide_String;
990 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
991 return Unbounded_Wide_String
995 To_Unbounded_Wide_String
996 (Wide_Fixed.Translate
997 (Source.Reference (1 .. Source.Last), Mapping));
1001 (Source : in out Unbounded_Wide_String;
1002 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
1005 Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
1013 (Source : Unbounded_Wide_String;
1014 Side : Trim_End) return Unbounded_Wide_String
1018 To_Unbounded_Wide_String
1019 (Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
1023 (Source : in out Unbounded_Wide_String;
1026 Old : Wide_String_Access := Source.Reference;
1030 (Wide_Fixed
.Trim
(Source
.Reference
(1 .. Source
.Last
), Side
));
1031 Source
.Last
:= Source
.Reference
'Length;
1036 (Source
: Unbounded_Wide_String
;
1037 Left
: Wide_Maps
.Wide_Character_Set
;
1038 Right
: Wide_Maps
.Wide_Character_Set
)
1039 return Unbounded_Wide_String
1043 To_Unbounded_Wide_String
1045 (Source
.Reference
(1 .. Source
.Last
), Left
, Right
));
1049 (Source
: in out Unbounded_Wide_String
;
1050 Left
: Wide_Maps
.Wide_Character_Set
;
1051 Right
: Wide_Maps
.Wide_Character_Set
)
1053 Old
: Wide_String_Access
:= Source
.Reference
;
1058 (Source.Reference (1 .. Source.Last), Left, Right));
1059 Source.Last := Source.Reference'Length;
1063 ---------------------
1064 -- Unbounded_Slice --
1065 ---------------------
1067 function Unbounded_Slice
1068 (Source : Unbounded_Wide_String;
1070 High : Natural) return Unbounded_Wide_String
1073 if Low > Source.Last + 1 or else High > Source.Last then
1076 return To_Unbounded_Wide_String (Source.Reference.all (Low .. High));
1078 end Unbounded_Slice;
1080 procedure Unbounded_Slice
1081 (Source : Unbounded_Wide_String;
1082 Target : out Unbounded_Wide_String;
1087 if Low > Source.Last + 1 or else High > Source.Last then
1091 To_Unbounded_Wide_String (Source.Reference.all (Low .. High));
1093 end Unbounded_Slice;
1095 end Ada.Strings.Wide_Unbounded;