Daily bump.
[official-gcc.git] / gcc / ada / a-stwiun.adb
blobf6392682b16a01b8d6fe0d030656aa06e8f8f9bd
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUNTIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
6 -- --
7 -- B o d y --
8 -- --
9 -- $Revision: 1.14 $
10 -- --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 -- --
34 ------------------------------------------------------------------------------
36 with Ada.Strings.Wide_Fixed;
37 with Ada.Strings.Wide_Search;
38 with Ada.Unchecked_Deallocation;
40 package body Ada.Strings.Wide_Unbounded is
42 use Ada.Finalization;
44 ---------
45 -- "&" --
46 ---------
48 function "&"
49 (Left : Unbounded_Wide_String;
50 Right : Unbounded_Wide_String)
51 return Unbounded_Wide_String
53 L_Length : constant Integer := Left.Reference.all'Length;
54 R_Length : constant Integer := Right.Reference.all'Length;
55 Length : constant Integer := L_Length + R_Length;
56 Result : Unbounded_Wide_String;
58 begin
59 Result.Reference := new Wide_String (1 .. Length);
60 Result.Reference.all (1 .. L_Length) := Left.Reference.all;
61 Result.Reference.all (L_Length + 1 .. Length) := Right.Reference.all;
62 return Result;
63 end "&";
65 function "&"
66 (Left : Unbounded_Wide_String;
67 Right : Wide_String)
68 return Unbounded_Wide_String
70 L_Length : constant Integer := Left.Reference.all'Length;
71 Length : constant Integer := L_Length + Right'Length;
72 Result : Unbounded_Wide_String;
74 begin
75 Result.Reference := new Wide_String (1 .. Length);
76 Result.Reference.all (1 .. L_Length) := Left.Reference.all;
77 Result.Reference.all (L_Length + 1 .. Length) := Right;
78 return Result;
79 end "&";
81 function "&"
82 (Left : Wide_String;
83 Right : Unbounded_Wide_String)
84 return Unbounded_Wide_String
86 R_Length : constant Integer := Right.Reference.all'Length;
87 Length : constant Integer := Left'Length + R_Length;
88 Result : Unbounded_Wide_String;
90 begin
91 Result.Reference := new Wide_String (1 .. Length);
92 Result.Reference.all (1 .. Left'Length) := Left;
93 Result.Reference.all (Left'Length + 1 .. Length) := Right.Reference.all;
94 return Result;
95 end "&";
97 function "&"
98 (Left : Unbounded_Wide_String;
99 Right : Wide_Character)
100 return Unbounded_Wide_String
102 Length : constant Integer := Left.Reference.all'Length + 1;
103 Result : Unbounded_Wide_String;
105 begin
106 Result.Reference := new Wide_String (1 .. Length);
107 Result.Reference.all (1 .. Length - 1) := Left.Reference.all;
108 Result.Reference.all (Length) := Right;
109 return Result;
110 end "&";
112 function "&"
113 (Left : Wide_Character;
114 Right : Unbounded_Wide_String)
115 return Unbounded_Wide_String
117 Length : constant Integer := Right.Reference.all'Length + 1;
118 Result : Unbounded_Wide_String;
120 begin
121 Result.Reference := new Wide_String (1 .. Length);
122 Result.Reference.all (1) := Left;
123 Result.Reference.all (2 .. Length) := Right.Reference.all;
124 return Result;
125 end "&";
127 ---------
128 -- "*" --
129 ---------
131 function "*"
132 (Left : Natural;
133 Right : Wide_Character)
134 return Unbounded_Wide_String
136 Result : Unbounded_Wide_String;
138 begin
139 Result.Reference := new Wide_String (1 .. Left);
140 for J in Result.Reference'Range loop
141 Result.Reference (J) := Right;
142 end loop;
144 return Result;
145 end "*";
147 function "*"
148 (Left : Natural;
149 Right : Wide_String)
150 return Unbounded_Wide_String
152 Result : Unbounded_Wide_String;
154 begin
155 Result.Reference := new Wide_String (1 .. Left * Right'Length);
157 for J in 1 .. Left loop
158 Result.Reference.all
159 (Right'Length * J - Right'Length + 1 .. Right'Length * J) := Right;
160 end loop;
162 return Result;
163 end "*";
165 function "*"
166 (Left : Natural;
167 Right : Unbounded_Wide_String)
168 return Unbounded_Wide_String
170 R_Length : constant Integer := Right.Reference.all'Length;
171 Result : Unbounded_Wide_String;
173 begin
174 Result.Reference := new Wide_String (1 .. Left * R_Length);
176 for I in 1 .. Left loop
177 Result.Reference.all (R_Length * I - R_Length + 1 .. R_Length * I) :=
178 Right.Reference.all;
179 end loop;
181 return Result;
182 end "*";
184 ---------
185 -- "<" --
186 ---------
188 function "<"
189 (Left : in Unbounded_Wide_String;
190 Right : in Unbounded_Wide_String)
191 return Boolean
193 begin
194 return Left.Reference.all < Right.Reference.all;
195 end "<";
197 function "<"
198 (Left : in Unbounded_Wide_String;
199 Right : in Wide_String)
200 return Boolean
202 begin
203 return Left.Reference.all < Right;
204 end "<";
206 function "<"
207 (Left : in Wide_String;
208 Right : in Unbounded_Wide_String)
209 return Boolean
211 begin
212 return Left < Right.Reference.all;
213 end "<";
215 ----------
216 -- "<=" --
217 ----------
219 function "<="
220 (Left : in Unbounded_Wide_String;
221 Right : in Unbounded_Wide_String)
222 return Boolean
224 begin
225 return Left.Reference.all <= Right.Reference.all;
226 end "<=";
228 function "<="
229 (Left : in Unbounded_Wide_String;
230 Right : in Wide_String)
231 return Boolean
233 begin
234 return Left.Reference.all <= Right;
235 end "<=";
237 function "<="
238 (Left : in Wide_String;
239 Right : in Unbounded_Wide_String)
240 return Boolean
242 begin
243 return Left <= Right.Reference.all;
244 end "<=";
246 ---------
247 -- "=" --
248 ---------
250 function "="
251 (Left : in Unbounded_Wide_String;
252 Right : in Unbounded_Wide_String)
253 return Boolean
255 begin
256 return Left.Reference.all = Right.Reference.all;
257 end "=";
259 function "="
260 (Left : in Unbounded_Wide_String;
261 Right : in Wide_String)
262 return Boolean
264 begin
265 return Left.Reference.all = Right;
266 end "=";
268 function "="
269 (Left : in Wide_String;
270 Right : in Unbounded_Wide_String)
271 return Boolean
273 begin
274 return Left = Right.Reference.all;
275 end "=";
277 ---------
278 -- ">" --
279 ---------
281 function ">"
282 (Left : in Unbounded_Wide_String;
283 Right : in Unbounded_Wide_String)
284 return Boolean
286 begin
287 return Left.Reference.all > Right.Reference.all;
288 end ">";
290 function ">"
291 (Left : in Unbounded_Wide_String;
292 Right : in Wide_String)
293 return Boolean
295 begin
296 return Left.Reference.all > Right;
297 end ">";
299 function ">"
300 (Left : in Wide_String;
301 Right : in Unbounded_Wide_String)
302 return Boolean
304 begin
305 return Left > Right.Reference.all;
306 end ">";
308 ----------
309 -- ">=" --
310 ----------
312 function ">="
313 (Left : in Unbounded_Wide_String;
314 Right : in Unbounded_Wide_String)
315 return Boolean
317 begin
318 return Left.Reference.all >= Right.Reference.all;
319 end ">=";
321 function ">="
322 (Left : in Unbounded_Wide_String;
323 Right : in Wide_String)
324 return Boolean
326 begin
327 return Left.Reference.all >= Right;
328 end ">=";
330 function ">="
331 (Left : in Wide_String;
332 Right : in Unbounded_Wide_String)
333 return Boolean
335 begin
336 return Left >= Right.Reference.all;
337 end ">=";
339 ------------
340 -- Adjust --
341 ------------
343 procedure Adjust (Object : in out Unbounded_Wide_String) is
344 begin
345 -- Copy string, except we do not copy the statically allocated
346 -- null string, since it can never be deallocated.
348 if Object.Reference /= Null_Wide_String'Access then
349 Object.Reference := new Wide_String'(Object.Reference.all);
350 end if;
351 end Adjust;
353 ------------
354 -- Append --
355 ------------
357 procedure Append
358 (Source : in out Unbounded_Wide_String;
359 New_Item : in Unbounded_Wide_String)
361 S_Length : constant Integer := Source.Reference.all'Length;
362 Length : constant Integer := S_Length + New_Item.Reference.all'Length;
363 Temp : Wide_String_Access := Source.Reference;
365 begin
366 if Source.Reference = Null_Wide_String'Access then
367 Source := To_Unbounded_Wide_String (New_Item.Reference.all);
368 return;
369 end if;
371 Source.Reference := new Wide_String (1 .. Length);
373 Source.Reference.all (1 .. S_Length) := Temp.all;
374 Source.Reference.all (S_Length + 1 .. Length) := New_Item.Reference.all;
375 Free (Temp);
376 end Append;
378 procedure Append
379 (Source : in out Unbounded_Wide_String;
380 New_Item : in Wide_String)
382 S_Length : constant Integer := Source.Reference.all'Length;
383 Length : constant Integer := S_Length + New_Item'Length;
384 Temp : Wide_String_Access := Source.Reference;
386 begin
387 if Source.Reference = Null_Wide_String'Access then
388 Source := To_Unbounded_Wide_String (New_Item);
389 return;
390 end if;
392 Source.Reference := new Wide_String (1 .. Length);
393 Source.Reference.all (1 .. S_Length) := Temp.all;
394 Source.Reference.all (S_Length + 1 .. Length) := New_Item;
395 Free (Temp);
396 end Append;
398 procedure Append
399 (Source : in out Unbounded_Wide_String;
400 New_Item : in Wide_Character)
402 S_Length : constant Integer := Source.Reference.all'Length;
403 Length : constant Integer := S_Length + 1;
404 Temp : Wide_String_Access := Source.Reference;
406 begin
407 if Source.Reference = Null_Wide_String'Access then
408 Source := To_Unbounded_Wide_String ("" & New_Item);
409 return;
410 end if;
412 Source.Reference := new Wide_String (1 .. Length);
413 Source.Reference.all (1 .. S_Length) := Temp.all;
414 Source.Reference.all (S_Length + 1) := New_Item;
415 Free (Temp);
416 end Append;
418 -----------
419 -- Count --
420 -----------
422 function Count
423 (Source : Unbounded_Wide_String;
424 Pattern : Wide_String;
425 Mapping : Wide_Maps.Wide_Character_Mapping :=
426 Wide_Maps.Identity)
427 return Natural
429 begin
430 return Wide_Search.Count (Source.Reference.all, Pattern, Mapping);
431 end Count;
433 function Count
434 (Source : in Unbounded_Wide_String;
435 Pattern : in Wide_String;
436 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
437 return Natural
439 begin
440 return Wide_Search.Count (Source.Reference.all, Pattern, Mapping);
441 end Count;
443 function Count
444 (Source : Unbounded_Wide_String;
445 Set : Wide_Maps.Wide_Character_Set)
446 return Natural
448 begin
449 return Wide_Search.Count (Source.Reference.all, Set);
450 end Count;
452 ------------
453 -- Delete --
454 ------------
456 function Delete
457 (Source : Unbounded_Wide_String;
458 From : Positive;
459 Through : Natural)
460 return Unbounded_Wide_String
462 begin
463 return
464 To_Unbounded_Wide_String
465 (Wide_Fixed.Delete (Source.Reference.all, From, Through));
466 end Delete;
468 procedure Delete
469 (Source : in out Unbounded_Wide_String;
470 From : in Positive;
471 Through : in Natural)
473 Temp : Wide_String_Access := Source.Reference;
474 begin
475 Source := To_Unbounded_Wide_String
476 (Wide_Fixed.Delete (Temp.all, From, Through));
477 end Delete;
479 -------------
480 -- Element --
481 -------------
483 function Element
484 (Source : Unbounded_Wide_String;
485 Index : Positive)
486 return Wide_Character
488 begin
489 if Index <= Source.Reference.all'Last then
490 return Source.Reference.all (Index);
491 else
492 raise Strings.Index_Error;
493 end if;
494 end Element;
496 --------------
497 -- Finalize --
498 --------------
500 procedure Finalize (Object : in out Unbounded_Wide_String) is
501 procedure Deallocate is
502 new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
504 begin
505 -- Note: Don't try to free statically allocated null string
507 if Object.Reference /= Null_Wide_String'Access then
508 Deallocate (Object.Reference);
509 Object.Reference := Null_Unbounded_Wide_String.Reference;
510 end if;
511 end Finalize;
513 ----------------
514 -- Find_Token --
515 ----------------
517 procedure Find_Token
518 (Source : Unbounded_Wide_String;
519 Set : Wide_Maps.Wide_Character_Set;
520 Test : Strings.Membership;
521 First : out Positive;
522 Last : out Natural)
524 begin
525 Wide_Search.Find_Token (Source.Reference.all, Set, Test, First, Last);
526 end Find_Token;
528 ----------
529 -- Free --
530 ----------
532 procedure Free (X : in out Wide_String_Access) is
533 procedure Deallocate is
534 new Ada.Unchecked_Deallocation (Wide_String, Wide_String_Access);
535 begin
536 Deallocate (X);
537 end Free;
539 ----------
540 -- Head --
541 ----------
543 function Head
544 (Source : Unbounded_Wide_String;
545 Count : Natural;
546 Pad : Wide_Character := Wide_Space)
547 return Unbounded_Wide_String
549 begin
550 return
551 To_Unbounded_Wide_String
552 (Wide_Fixed.Head (Source.Reference.all, Count, Pad));
553 end Head;
555 procedure Head
556 (Source : in out Unbounded_Wide_String;
557 Count : in Natural;
558 Pad : in Wide_Character := Wide_Space)
560 begin
561 Source := To_Unbounded_Wide_String
562 (Wide_Fixed.Head (Source.Reference.all, Count, Pad));
563 end Head;
565 -----------
566 -- Index --
567 -----------
569 function Index
570 (Source : Unbounded_Wide_String;
571 Pattern : Wide_String;
572 Going : Strings.Direction := Strings.Forward;
573 Mapping : Wide_Maps.Wide_Character_Mapping :=
574 Wide_Maps.Identity)
575 return Natural
577 begin
578 return
579 Wide_Search.Index (Source.Reference.all, Pattern, Going, Mapping);
580 end Index;
582 function Index
583 (Source : in Unbounded_Wide_String;
584 Pattern : in Wide_String;
585 Going : in Direction := Forward;
586 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
587 return Natural
589 begin
590 return
591 Wide_Search.Index (Source.Reference.all, Pattern, Going, Mapping);
592 end Index;
594 function Index
595 (Source : Unbounded_Wide_String;
596 Set : Wide_Maps.Wide_Character_Set;
597 Test : Strings.Membership := Strings.Inside;
598 Going : Strings.Direction := Strings.Forward)
599 return Natural
601 begin
602 return Wide_Search.Index (Source.Reference.all, Set, Test, Going);
603 end Index;
605 function Index_Non_Blank
606 (Source : Unbounded_Wide_String;
607 Going : Strings.Direction := Strings.Forward)
608 return Natural
610 begin
611 return Wide_Search.Index_Non_Blank (Source.Reference.all, Going);
612 end Index_Non_Blank;
614 ----------------
615 -- Initialize --
616 ----------------
618 procedure Initialize (Object : in out Unbounded_Wide_String) is
619 begin
620 Object.Reference := Null_Unbounded_Wide_String.Reference;
621 end Initialize;
623 ------------
624 -- Insert --
625 ------------
627 function Insert
628 (Source : Unbounded_Wide_String;
629 Before : Positive;
630 New_Item : Wide_String)
631 return Unbounded_Wide_String
633 begin
634 return
635 To_Unbounded_Wide_String
636 (Wide_Fixed.Insert (Source.Reference.all, Before, New_Item));
637 end Insert;
639 procedure Insert
640 (Source : in out Unbounded_Wide_String;
641 Before : in Positive;
642 New_Item : in Wide_String)
644 begin
645 Source := To_Unbounded_Wide_String
646 (Wide_Fixed.Insert (Source.Reference.all, Before, New_Item));
647 end Insert;
649 ------------
650 -- Length --
651 ------------
653 function Length (Source : Unbounded_Wide_String) return Natural is
654 begin
655 return Source.Reference.all'Length;
656 end Length;
658 ---------------
659 -- Overwrite --
660 ---------------
662 function Overwrite
663 (Source : Unbounded_Wide_String;
664 Position : Positive;
665 New_Item : Wide_String)
666 return Unbounded_Wide_String is
668 begin
669 return To_Unbounded_Wide_String
670 (Wide_Fixed.Overwrite (Source.Reference.all, Position, New_Item));
671 end Overwrite;
673 procedure Overwrite
674 (Source : in out Unbounded_Wide_String;
675 Position : in Positive;
676 New_Item : in Wide_String)
678 Temp : Wide_String_Access := Source.Reference;
679 begin
680 Source := To_Unbounded_Wide_String
681 (Wide_Fixed.Overwrite (Temp.all, Position, New_Item));
682 end Overwrite;
684 ---------------------
685 -- Replace_Element --
686 ---------------------
688 procedure Replace_Element
689 (Source : in out Unbounded_Wide_String;
690 Index : Positive;
691 By : Wide_Character)
693 begin
694 if Index <= Source.Reference.all'Last then
695 Source.Reference.all (Index) := By;
696 else
697 raise Strings.Index_Error;
698 end if;
699 end Replace_Element;
701 -------------------
702 -- Replace_Slice --
703 -------------------
705 function Replace_Slice
706 (Source : Unbounded_Wide_String;
707 Low : Positive;
708 High : Natural;
709 By : Wide_String)
710 return Unbounded_Wide_String
712 begin
713 return
714 To_Unbounded_Wide_String
715 (Wide_Fixed.Replace_Slice (Source.Reference.all, Low, High, By));
716 end Replace_Slice;
718 procedure Replace_Slice
719 (Source : in out Unbounded_Wide_String;
720 Low : in Positive;
721 High : in Natural;
722 By : in Wide_String)
724 Temp : Wide_String_Access := Source.Reference;
725 begin
726 Source := To_Unbounded_Wide_String
727 (Wide_Fixed.Replace_Slice (Temp.all, Low, High, By));
728 end Replace_Slice;
730 -----------
731 -- Slice --
732 -----------
734 function Slice
735 (Source : Unbounded_Wide_String;
736 Low : Positive;
737 High : Natural)
738 return Wide_String
740 Length : constant Natural := Source.Reference'Length;
742 begin
743 -- Note: test of High > Length is in accordance with AI95-00128
745 if Low > Length + 1 or else High > Length then
746 raise Index_Error;
748 else
749 declare
750 Result : Wide_String (1 .. High - Low + 1);
752 begin
753 Result := Source.Reference.all (Low .. High);
754 return Result;
755 end;
756 end if;
757 end Slice;
759 ----------
760 -- Tail --
761 ----------
763 function Tail
764 (Source : Unbounded_Wide_String;
765 Count : Natural;
766 Pad : Wide_Character := Wide_Space)
767 return Unbounded_Wide_String is
769 begin
770 return
771 To_Unbounded_Wide_String
772 (Wide_Fixed.Tail (Source.Reference.all, Count, Pad));
773 end Tail;
775 procedure Tail
776 (Source : in out Unbounded_Wide_String;
777 Count : in Natural;
778 Pad : in Wide_Character := Wide_Space)
780 Temp : Wide_String_Access := Source.Reference;
782 begin
783 Source := To_Unbounded_Wide_String
784 (Wide_Fixed.Tail (Temp.all, Count, Pad));
785 end Tail;
787 ------------------------------
788 -- To_Unbounded_Wide_String --
789 ------------------------------
791 function To_Unbounded_Wide_String
792 (Source : Wide_String)
793 return Unbounded_Wide_String
795 Result : Unbounded_Wide_String;
797 begin
798 Result.Reference := new Wide_String (1 .. Source'Length);
799 Result.Reference.all := Source;
800 return Result;
801 end To_Unbounded_Wide_String;
803 function To_Unbounded_Wide_String (Length : in Natural)
804 return Unbounded_Wide_String
806 Result : Unbounded_Wide_String;
808 begin
809 Result.Reference := new Wide_String (1 .. Length);
810 return Result;
811 end To_Unbounded_Wide_String;
813 --------------------
814 -- To_Wide_String --
815 --------------------
817 function To_Wide_String
818 (Source : Unbounded_Wide_String)
819 return Wide_String
821 begin
822 return Source.Reference.all;
823 end To_Wide_String;
825 ---------------
826 -- Translate --
827 ---------------
829 function Translate
830 (Source : Unbounded_Wide_String;
831 Mapping : Wide_Maps.Wide_Character_Mapping)
832 return Unbounded_Wide_String
834 begin
835 return
836 To_Unbounded_Wide_String
837 (Wide_Fixed.Translate (Source.Reference.all, Mapping));
838 end Translate;
840 procedure Translate
841 (Source : in out Unbounded_Wide_String;
842 Mapping : Wide_Maps.Wide_Character_Mapping)
844 begin
845 Wide_Fixed.Translate (Source.Reference.all, Mapping);
846 end Translate;
848 function Translate
849 (Source : in Unbounded_Wide_String;
850 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
851 return Unbounded_Wide_String
853 begin
854 return
855 To_Unbounded_Wide_String
856 (Wide_Fixed.Translate (Source.Reference.all, Mapping));
857 end Translate;
859 procedure Translate
860 (Source : in out Unbounded_Wide_String;
861 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
863 begin
864 Wide_Fixed.Translate (Source.Reference.all, Mapping);
865 end Translate;
867 ----------
868 -- Trim --
869 ----------
871 function Trim
872 (Source : in Unbounded_Wide_String;
873 Side : in Trim_End)
874 return Unbounded_Wide_String
876 begin
877 return
878 To_Unbounded_Wide_String
879 (Wide_Fixed.Trim (Source.Reference.all, Side));
880 end Trim;
882 procedure Trim
883 (Source : in out Unbounded_Wide_String;
884 Side : in Trim_End)
886 Old : Wide_String_Access := Source.Reference;
887 begin
888 Source.Reference := new Wide_String'(Wide_Fixed.Trim (Old.all, Side));
889 Free (Old);
890 end Trim;
892 function Trim
893 (Source : in Unbounded_Wide_String;
894 Left : in Wide_Maps.Wide_Character_Set;
895 Right : in Wide_Maps.Wide_Character_Set)
896 return Unbounded_Wide_String
898 begin
899 return
900 To_Unbounded_Wide_String
901 (Wide_Fixed.Trim (Source.Reference.all, Left, Right));
902 end Trim;
904 procedure Trim
905 (Source : in out Unbounded_Wide_String;
906 Left : in Wide_Maps.Wide_Character_Set;
907 Right : in Wide_Maps.Wide_Character_Set)
909 Old : Wide_String_Access := Source.Reference;
911 begin
912 Source.Reference :=
913 new Wide_String'(Wide_Fixed.Trim (Old.all, Left, Right));
914 Free (Old);
915 end Trim;
917 end Ada.Strings.Wide_Unbounded;