1------------------------------------------------------------------------------
2--                                                                          --
3--                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4--                                                                          --
5--              S Y S T E M . S T R I N G S . S T R E A M _ O P S           --
6--                                                                          --
7--                                 B o d y                                  --
8--                                                                          --
9--          Copyright (C) 2008-2013, Free Software Foundation, Inc.         --
10--                                                                          --
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.                                     --
17--                                                                          --
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.               --
21--                                                                          --
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/>.                                          --
26--                                                                          --
27-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
32pragma Compiler_Unit_Warning;
33
34with Ada.Streams;              use Ada.Streams;
35with Ada.Streams.Stream_IO;    use Ada.Streams.Stream_IO;
36with Ada.Unchecked_Conversion;
37
38with System;                   use System;
39with System.Storage_Elements;  use System.Storage_Elements;
40with System.Stream_Attributes;
41
42package body System.Strings.Stream_Ops is
43
44   --  The following type describes the low-level IO mechanism used in package
45   --  Stream_Ops_Internal.
46
47   type IO_Kind is (Byte_IO, Block_IO);
48
49   --  The following package provides an IO framework for strings. Depending
50   --  on the version of System.Stream_Attributes as well as the size of
51   --  formal parameter Element_Type, the package will either utilize block
52   --  IO or element-by-element IO.
53
54   generic
55      type Element_Type is private;
56      type Index_Type is range <>;
57      type Array_Type is array (Index_Type range <>) of Element_Type;
58
59   package Stream_Ops_Internal is
60      function Input
61        (Strm : access Root_Stream_Type'Class;
62         IO   : IO_Kind) return Array_Type;
63
64      procedure Output
65        (Strm : access Root_Stream_Type'Class;
66         Item : Array_Type;
67         IO   : IO_Kind);
68
69      procedure Read
70        (Strm : access Root_Stream_Type'Class;
71         Item : out Array_Type;
72         IO   : IO_Kind);
73
74      procedure Write
75        (Strm : access Root_Stream_Type'Class;
76         Item : Array_Type;
77         IO   : IO_Kind);
78   end Stream_Ops_Internal;
79
80   -------------------------
81   -- Stream_Ops_Internal --
82   -------------------------
83
84   package body Stream_Ops_Internal is
85
86      --  The following value represents the number of BITS allocated for the
87      --  default block used in string IO. The sizes of all other types are
88      --  calculated relative to this value.
89
90      Default_Block_Size : constant := 512 * 8;
91
92      --  Shorthand notation for stream element and element type sizes
93
94      ET_Size : constant Integer := Element_Type'Size;
95      SE_Size : constant Integer := Stream_Element'Size;
96
97      --  The following constants describe the number of array elements or
98      --  stream elements that can fit into a default block.
99
100      AE_In_Default_Block : constant Index_Type :=
101                              Index_Type (Default_Block_Size / ET_Size);
102      --  Number of array elements in a default block
103
104      SE_In_Default_Block : constant Integer := Default_Block_Size / SE_Size;
105      --  Number of storage elements in a default block
106
107      --  Buffer types
108
109      subtype Default_Block is Stream_Element_Array
110        (1 .. Stream_Element_Offset (SE_In_Default_Block));
111
112      subtype Array_Block is
113        Array_Type (Index_Type range 1 .. AE_In_Default_Block);
114
115      --  Conversions to and from Default_Block
116
117      function To_Default_Block is
118        new Ada.Unchecked_Conversion (Array_Block, Default_Block);
119
120      function To_Array_Block is
121        new Ada.Unchecked_Conversion (Default_Block, Array_Block);
122
123      -----------
124      -- Input --
125      -----------
126
127      function Input
128        (Strm : access Root_Stream_Type'Class;
129         IO   : IO_Kind) return Array_Type
130      is
131      begin
132         if Strm = null then
133            raise Constraint_Error;
134         end if;
135
136         declare
137            Low  : Index_Type;
138            High : Index_Type;
139
140         begin
141            --  Read the bounds of the string
142
143            Index_Type'Read (Strm, Low);
144            Index_Type'Read (Strm, High);
145
146            --  Read the character content of the string
147
148            declare
149               Item : Array_Type (Low .. High);
150            begin
151               Read (Strm, Item, IO);
152               return Item;
153            end;
154         end;
155      end Input;
156
157      ------------
158      -- Output --
159      ------------
160
161      procedure Output
162        (Strm : access Root_Stream_Type'Class;
163         Item : Array_Type;
164         IO   : IO_Kind)
165      is
166      begin
167         if Strm = null then
168            raise Constraint_Error;
169         end if;
170
171         --  Write the bounds of the string
172
173         Index_Type'Write (Strm, Item'First);
174         Index_Type'Write (Strm, Item'Last);
175
176         --  Write the character content of the string
177
178         Write (Strm, Item, IO);
179      end Output;
180
181      ----------
182      -- Read --
183      ----------
184
185      procedure Read
186        (Strm : access Root_Stream_Type'Class;
187         Item : out Array_Type;
188         IO   : IO_Kind)
189      is
190      begin
191         if Strm = null then
192            raise Constraint_Error;
193         end if;
194
195         --  Nothing to do if the desired string is empty
196
197         if Item'Length = 0 then
198            return;
199         end if;
200
201         --  Block IO
202
203         if IO = Block_IO and then Stream_Attributes.Block_IO_OK then
204            declare
205               --  Determine the size in BITS of the block necessary to contain
206               --  the whole string.
207
208               Block_Size : constant Natural :=
209                              Integer (Item'Last - Item'First + 1) * ET_Size;
210
211               --  Item can be larger than what the default block can store,
212               --  determine the number of whole reads necessary to read the
213               --  string.
214
215               Blocks : constant Natural := Block_Size / Default_Block_Size;
216
217               --  The size of Item may not be a multiple of the default block
218               --  size, determine the size of the remaining chunk in BITS.
219
220               Rem_Size : constant Natural :=
221                            Block_Size mod Default_Block_Size;
222
223               --  String indexes
224
225               Low  : Index_Type := Item'First;
226               High : Index_Type := Low + AE_In_Default_Block - 1;
227
228               --  End of stream error detection
229
230               Last : Stream_Element_Offset := 0;
231               Sum  : Stream_Element_Offset := 0;
232
233            begin
234               --  Step 1: If the string is too large, read in individual
235               --  chunks the size of the default block.
236
237               if Blocks > 0 then
238                  declare
239                     Block : Default_Block;
240
241                  begin
242                     for Counter in 1 .. Blocks loop
243                        Read (Strm.all, Block, Last);
244                        Item (Low .. High) := To_Array_Block (Block);
245
246                        Low  := High + 1;
247                        High := Low + AE_In_Default_Block - 1;
248                        Sum  := Sum + Last;
249                        Last := 0;
250                     end loop;
251                  end;
252               end if;
253
254               --  Step 2: Read in any remaining elements
255
256               if Rem_Size > 0 then
257                  declare
258                     subtype Rem_Block is Stream_Element_Array
259                       (1 .. Stream_Element_Offset (Rem_Size / SE_Size));
260
261                     subtype Rem_Array_Block is
262                       Array_Type (Index_Type range
263                                    1 .. Index_Type (Rem_Size / ET_Size));
264
265                     function To_Rem_Array_Block is new
266                       Ada.Unchecked_Conversion (Rem_Block, Rem_Array_Block);
267
268                     Block : Rem_Block;
269
270                  begin
271                     Read (Strm.all, Block, Last);
272                     Item (Low .. Item'Last) := To_Rem_Array_Block (Block);
273
274                     Sum := Sum + Last;
275                  end;
276               end if;
277
278               --  Step 3: Potential error detection. The sum of all the
279               --  chunks is less than we initially wanted to read. In other
280               --  words, the stream does not contain enough elements to fully
281               --  populate Item.
282
283               if (Integer (Sum) * SE_Size) / ET_Size < Item'Length then
284                  raise End_Error;
285               end if;
286            end;
287
288         --  Byte IO
289
290         else
291            declare
292               E : Element_Type;
293            begin
294               for Index in Item'First .. Item'Last loop
295                  Element_Type'Read (Strm, E);
296                  Item (Index) := E;
297               end loop;
298            end;
299         end if;
300      end Read;
301
302      -----------
303      -- Write --
304      -----------
305
306      procedure Write
307        (Strm : access Root_Stream_Type'Class;
308         Item : Array_Type;
309         IO   : IO_Kind)
310      is
311      begin
312         if Strm = null then
313            raise Constraint_Error;
314         end if;
315
316         --  Nothing to do if the input string is empty
317
318         if Item'Length = 0 then
319            return;
320         end if;
321
322         --  Block IO
323
324         if IO = Block_IO and then Stream_Attributes.Block_IO_OK then
325            declare
326               --  Determine the size in BITS of the block necessary to contain
327               --  the whole string.
328
329               Block_Size : constant Natural := Item'Length * ET_Size;
330
331               --  Item can be larger than what the default block can store,
332               --  determine the number of whole writes necessary to output the
333               --  string.
334
335               Blocks : constant Natural := Block_Size / Default_Block_Size;
336
337               --  The size of Item may not be a multiple of the default block
338               --  size, determine the size of the remaining chunk.
339
340               Rem_Size : constant Natural :=
341                            Block_Size mod Default_Block_Size;
342
343               --  String indexes
344
345               Low  : Index_Type := Item'First;
346               High : Index_Type := Low + AE_In_Default_Block - 1;
347
348            begin
349               --  Step 1: If the string is too large, write out individual
350               --  chunks the size of the default block.
351
352               for Counter in 1 .. Blocks loop
353                  Write (Strm.all, To_Default_Block (Item (Low .. High)));
354                  Low  := High + 1;
355                  High := Low + AE_In_Default_Block - 1;
356               end loop;
357
358               --  Step 2: Write out any remaining elements
359
360               if Rem_Size > 0 then
361                  declare
362                     subtype Rem_Block is Stream_Element_Array
363                       (1 .. Stream_Element_Offset (Rem_Size / SE_Size));
364
365                     subtype Rem_Array_Block is
366                       Array_Type (Index_Type range
367                                     1 .. Index_Type (Rem_Size / ET_Size));
368
369                     function To_Rem_Block is new
370                       Ada.Unchecked_Conversion (Rem_Array_Block, Rem_Block);
371
372                  begin
373                     Write (Strm.all, To_Rem_Block (Item (Low .. Item'Last)));
374                  end;
375               end if;
376            end;
377
378         --  Byte IO
379
380         else
381            for Index in Item'First .. Item'Last loop
382               Element_Type'Write (Strm, Item (Index));
383            end loop;
384         end if;
385      end Write;
386   end Stream_Ops_Internal;
387
388   --  Specific instantiations for all Ada array types handled
389
390   package Storage_Array_Ops is
391     new Stream_Ops_Internal
392       (Element_Type => Storage_Element,
393        Index_Type   => Storage_Offset,
394        Array_Type   => Storage_Array);
395
396   package Stream_Element_Array_Ops is
397     new Stream_Ops_Internal
398       (Element_Type => Stream_Element,
399        Index_Type   => Stream_Element_Offset,
400        Array_Type   => Stream_Element_Array);
401
402   package String_Ops is
403     new Stream_Ops_Internal
404       (Element_Type => Character,
405        Index_Type   => Positive,
406        Array_Type   => String);
407
408   package Wide_String_Ops is
409     new Stream_Ops_Internal
410       (Element_Type => Wide_Character,
411        Index_Type   => Positive,
412        Array_Type   => Wide_String);
413
414   package Wide_Wide_String_Ops is
415     new Stream_Ops_Internal
416       (Element_Type => Wide_Wide_Character,
417        Index_Type   => Positive,
418        Array_Type   => Wide_Wide_String);
419
420   -------------------------
421   -- Storage_Array_Input --
422   -------------------------
423
424   function Storage_Array_Input
425     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Storage_Array
426   is
427   begin
428      return Storage_Array_Ops.Input (Strm, Byte_IO);
429   end Storage_Array_Input;
430
431   --------------------------------
432   -- Storage_Array_Input_Blk_IO --
433   --------------------------------
434
435   function Storage_Array_Input_Blk_IO
436     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Storage_Array
437   is
438   begin
439      return Storage_Array_Ops.Input (Strm, Block_IO);
440   end Storage_Array_Input_Blk_IO;
441
442   --------------------------
443   -- Storage_Array_Output --
444   --------------------------
445
446   procedure Storage_Array_Output
447     (Strm : access Ada.Streams.Root_Stream_Type'Class;
448      Item : Storage_Array)
449   is
450   begin
451      Storage_Array_Ops.Output (Strm, Item, Byte_IO);
452   end Storage_Array_Output;
453
454   ---------------------------------
455   -- Storage_Array_Output_Blk_IO --
456   ---------------------------------
457
458   procedure Storage_Array_Output_Blk_IO
459     (Strm : access Ada.Streams.Root_Stream_Type'Class;
460      Item : Storage_Array)
461   is
462   begin
463      Storage_Array_Ops.Output (Strm, Item, Block_IO);
464   end Storage_Array_Output_Blk_IO;
465
466   ------------------------
467   -- Storage_Array_Read --
468   ------------------------
469
470   procedure Storage_Array_Read
471     (Strm : access Ada.Streams.Root_Stream_Type'Class;
472      Item : out Storage_Array)
473   is
474   begin
475      Storage_Array_Ops.Read (Strm, Item, Byte_IO);
476   end Storage_Array_Read;
477
478   -------------------------------
479   -- Storage_Array_Read_Blk_IO --
480   -------------------------------
481
482   procedure Storage_Array_Read_Blk_IO
483     (Strm : access Ada.Streams.Root_Stream_Type'Class;
484      Item : out Storage_Array)
485   is
486   begin
487      Storage_Array_Ops.Read (Strm, Item, Block_IO);
488   end Storage_Array_Read_Blk_IO;
489
490   -------------------------
491   -- Storage_Array_Write --
492   -------------------------
493
494   procedure Storage_Array_Write
495     (Strm : access Ada.Streams.Root_Stream_Type'Class;
496      Item : Storage_Array)
497   is
498   begin
499      Storage_Array_Ops.Write (Strm, Item, Byte_IO);
500   end Storage_Array_Write;
501
502   --------------------------------
503   -- Storage_Array_Write_Blk_IO --
504   --------------------------------
505
506   procedure Storage_Array_Write_Blk_IO
507     (Strm : access Ada.Streams.Root_Stream_Type'Class;
508      Item : Storage_Array)
509   is
510   begin
511      Storage_Array_Ops.Write (Strm, Item, Block_IO);
512   end Storage_Array_Write_Blk_IO;
513
514   --------------------------------
515   -- Stream_Element_Array_Input --
516   --------------------------------
517
518   function Stream_Element_Array_Input
519     (Strm : access Ada.Streams.Root_Stream_Type'Class)
520      return Stream_Element_Array
521   is
522   begin
523      return Stream_Element_Array_Ops.Input (Strm, Byte_IO);
524   end Stream_Element_Array_Input;
525
526   ---------------------------------------
527   -- Stream_Element_Array_Input_Blk_IO --
528   ---------------------------------------
529
530   function Stream_Element_Array_Input_Blk_IO
531     (Strm : access Ada.Streams.Root_Stream_Type'Class)
532      return Stream_Element_Array
533   is
534   begin
535      return Stream_Element_Array_Ops.Input (Strm, Block_IO);
536   end Stream_Element_Array_Input_Blk_IO;
537
538   ---------------------------------
539   -- Stream_Element_Array_Output --
540   ---------------------------------
541
542   procedure Stream_Element_Array_Output
543     (Strm : access Ada.Streams.Root_Stream_Type'Class;
544      Item : Stream_Element_Array)
545   is
546   begin
547      Stream_Element_Array_Ops.Output (Strm, Item, Byte_IO);
548   end Stream_Element_Array_Output;
549
550   ----------------------------------------
551   -- Stream_Element_Array_Output_Blk_IO --
552   ----------------------------------------
553
554   procedure Stream_Element_Array_Output_Blk_IO
555     (Strm : access Ada.Streams.Root_Stream_Type'Class;
556      Item : Stream_Element_Array)
557   is
558   begin
559      Stream_Element_Array_Ops.Output (Strm, Item, Block_IO);
560   end Stream_Element_Array_Output_Blk_IO;
561
562   -------------------------------
563   -- Stream_Element_Array_Read --
564   -------------------------------
565
566   procedure Stream_Element_Array_Read
567     (Strm : access Ada.Streams.Root_Stream_Type'Class;
568      Item : out Stream_Element_Array)
569   is
570   begin
571      Stream_Element_Array_Ops.Read (Strm, Item, Byte_IO);
572   end Stream_Element_Array_Read;
573
574   --------------------------------------
575   -- Stream_Element_Array_Read_Blk_IO --
576   --------------------------------------
577
578   procedure Stream_Element_Array_Read_Blk_IO
579     (Strm : access Ada.Streams.Root_Stream_Type'Class;
580      Item : out Stream_Element_Array)
581   is
582   begin
583      Stream_Element_Array_Ops.Read (Strm, Item, Block_IO);
584   end Stream_Element_Array_Read_Blk_IO;
585
586   --------------------------------
587   -- Stream_Element_Array_Write --
588   --------------------------------
589
590   procedure Stream_Element_Array_Write
591     (Strm : access Ada.Streams.Root_Stream_Type'Class;
592      Item : Stream_Element_Array)
593   is
594   begin
595      Stream_Element_Array_Ops.Write (Strm, Item, Byte_IO);
596   end Stream_Element_Array_Write;
597
598   ---------------------------------------
599   -- Stream_Element_Array_Write_Blk_IO --
600   ---------------------------------------
601
602   procedure Stream_Element_Array_Write_Blk_IO
603     (Strm : access Ada.Streams.Root_Stream_Type'Class;
604      Item : Stream_Element_Array)
605   is
606   begin
607      Stream_Element_Array_Ops.Write (Strm, Item, Block_IO);
608   end Stream_Element_Array_Write_Blk_IO;
609
610   ------------------
611   -- String_Input --
612   ------------------
613
614   function String_Input
615     (Strm : access Ada.Streams.Root_Stream_Type'Class) return String
616   is
617   begin
618      return String_Ops.Input (Strm, Byte_IO);
619   end String_Input;
620
621   -------------------------
622   -- String_Input_Blk_IO --
623   -------------------------
624
625   function String_Input_Blk_IO
626     (Strm : access Ada.Streams.Root_Stream_Type'Class) return String
627   is
628   begin
629      return String_Ops.Input (Strm, Block_IO);
630   end String_Input_Blk_IO;
631
632   -------------------
633   -- String_Output --
634   -------------------
635
636   procedure String_Output
637     (Strm : access Ada.Streams.Root_Stream_Type'Class;
638      Item : String)
639   is
640   begin
641      String_Ops.Output (Strm, Item, Byte_IO);
642   end String_Output;
643
644   --------------------------
645   -- String_Output_Blk_IO --
646   --------------------------
647
648   procedure String_Output_Blk_IO
649     (Strm : access Ada.Streams.Root_Stream_Type'Class;
650      Item : String)
651   is
652   begin
653      String_Ops.Output (Strm, Item, Block_IO);
654   end String_Output_Blk_IO;
655
656   -----------------
657   -- String_Read --
658   -----------------
659
660   procedure String_Read
661     (Strm : access Ada.Streams.Root_Stream_Type'Class;
662      Item : out String)
663   is
664   begin
665      String_Ops.Read (Strm, Item, Byte_IO);
666   end String_Read;
667
668   ------------------------
669   -- String_Read_Blk_IO --
670   ------------------------
671
672   procedure String_Read_Blk_IO
673     (Strm : access Ada.Streams.Root_Stream_Type'Class;
674      Item : out String)
675   is
676   begin
677      String_Ops.Read (Strm, Item, Block_IO);
678   end String_Read_Blk_IO;
679
680   ------------------
681   -- String_Write --
682   ------------------
683
684   procedure String_Write
685     (Strm : access Ada.Streams.Root_Stream_Type'Class;
686      Item : String)
687   is
688   begin
689      String_Ops.Write (Strm, Item, Byte_IO);
690   end String_Write;
691
692   -------------------------
693   -- String_Write_Blk_IO --
694   -------------------------
695
696   procedure String_Write_Blk_IO
697     (Strm : access Ada.Streams.Root_Stream_Type'Class;
698      Item : String)
699   is
700   begin
701      String_Ops.Write (Strm, Item, Block_IO);
702   end String_Write_Blk_IO;
703
704   -----------------------
705   -- Wide_String_Input --
706   -----------------------
707
708   function Wide_String_Input
709     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
710   is
711   begin
712      return Wide_String_Ops.Input (Strm, Byte_IO);
713   end Wide_String_Input;
714
715   ------------------------------
716   -- Wide_String_Input_Blk_IO --
717   ------------------------------
718
719   function Wide_String_Input_Blk_IO
720     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_String
721   is
722   begin
723      return Wide_String_Ops.Input (Strm, Block_IO);
724   end Wide_String_Input_Blk_IO;
725
726   ------------------------
727   -- Wide_String_Output --
728   ------------------------
729
730   procedure Wide_String_Output
731     (Strm : access Ada.Streams.Root_Stream_Type'Class;
732      Item : Wide_String)
733   is
734   begin
735      Wide_String_Ops.Output (Strm, Item, Byte_IO);
736   end Wide_String_Output;
737
738   -------------------------------
739   -- Wide_String_Output_Blk_IO --
740   -------------------------------
741
742   procedure Wide_String_Output_Blk_IO
743     (Strm : access Ada.Streams.Root_Stream_Type'Class;
744      Item : Wide_String)
745   is
746   begin
747      Wide_String_Ops.Output (Strm, Item, Block_IO);
748   end Wide_String_Output_Blk_IO;
749
750   ----------------------
751   -- Wide_String_Read --
752   ----------------------
753
754   procedure Wide_String_Read
755     (Strm : access Ada.Streams.Root_Stream_Type'Class;
756      Item : out Wide_String)
757   is
758   begin
759      Wide_String_Ops.Read (Strm, Item, Byte_IO);
760   end Wide_String_Read;
761
762   -----------------------------
763   -- Wide_String_Read_Blk_IO --
764   -----------------------------
765
766   procedure Wide_String_Read_Blk_IO
767     (Strm : access Ada.Streams.Root_Stream_Type'Class;
768      Item : out Wide_String)
769   is
770   begin
771      Wide_String_Ops.Read (Strm, Item, Block_IO);
772   end Wide_String_Read_Blk_IO;
773
774   -----------------------
775   -- Wide_String_Write --
776   -----------------------
777
778   procedure Wide_String_Write
779     (Strm : access Ada.Streams.Root_Stream_Type'Class;
780      Item : Wide_String)
781   is
782   begin
783      Wide_String_Ops.Write (Strm, Item, Byte_IO);
784   end Wide_String_Write;
785
786   ------------------------------
787   -- Wide_String_Write_Blk_IO --
788   ------------------------------
789
790   procedure Wide_String_Write_Blk_IO
791     (Strm : access Ada.Streams.Root_Stream_Type'Class;
792      Item : Wide_String)
793   is
794   begin
795      Wide_String_Ops.Write (Strm, Item, Block_IO);
796   end Wide_String_Write_Blk_IO;
797
798   ----------------------------
799   -- Wide_Wide_String_Input --
800   ----------------------------
801
802   function Wide_Wide_String_Input
803     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
804   is
805   begin
806      return Wide_Wide_String_Ops.Input (Strm, Byte_IO);
807   end Wide_Wide_String_Input;
808
809   -----------------------------------
810   -- Wide_Wide_String_Input_Blk_IO --
811   -----------------------------------
812
813   function Wide_Wide_String_Input_Blk_IO
814     (Strm : access Ada.Streams.Root_Stream_Type'Class) return Wide_Wide_String
815   is
816   begin
817      return Wide_Wide_String_Ops.Input (Strm, Block_IO);
818   end Wide_Wide_String_Input_Blk_IO;
819
820   -----------------------------
821   -- Wide_Wide_String_Output --
822   -----------------------------
823
824   procedure Wide_Wide_String_Output
825     (Strm : access Ada.Streams.Root_Stream_Type'Class;
826      Item : Wide_Wide_String)
827   is
828   begin
829      Wide_Wide_String_Ops.Output (Strm, Item, Byte_IO);
830   end Wide_Wide_String_Output;
831
832   ------------------------------------
833   -- Wide_Wide_String_Output_Blk_IO --
834   ------------------------------------
835
836   procedure Wide_Wide_String_Output_Blk_IO
837     (Strm : access Ada.Streams.Root_Stream_Type'Class;
838      Item : Wide_Wide_String)
839   is
840   begin
841      Wide_Wide_String_Ops.Output (Strm, Item, Block_IO);
842   end Wide_Wide_String_Output_Blk_IO;
843
844   ---------------------------
845   -- Wide_Wide_String_Read --
846   ---------------------------
847
848   procedure Wide_Wide_String_Read
849     (Strm : access Ada.Streams.Root_Stream_Type'Class;
850      Item : out Wide_Wide_String)
851   is
852   begin
853      Wide_Wide_String_Ops.Read (Strm, Item, Byte_IO);
854   end Wide_Wide_String_Read;
855
856   ----------------------------------
857   -- Wide_Wide_String_Read_Blk_IO --
858   ----------------------------------
859
860   procedure Wide_Wide_String_Read_Blk_IO
861     (Strm : access Ada.Streams.Root_Stream_Type'Class;
862      Item : out Wide_Wide_String)
863   is
864   begin
865      Wide_Wide_String_Ops.Read (Strm, Item, Block_IO);
866   end Wide_Wide_String_Read_Blk_IO;
867
868   ----------------------------
869   -- Wide_Wide_String_Write --
870   ----------------------------
871
872   procedure Wide_Wide_String_Write
873     (Strm : access Ada.Streams.Root_Stream_Type'Class;
874      Item : Wide_Wide_String)
875   is
876   begin
877      Wide_Wide_String_Ops.Write (Strm, Item, Byte_IO);
878   end Wide_Wide_String_Write;
879
880   -----------------------------------
881   -- Wide_Wide_String_Write_Blk_IO --
882   -----------------------------------
883
884   procedure Wide_Wide_String_Write_Blk_IO
885     (Strm : access Ada.Streams.Root_Stream_Type'Class;
886      Item : Wide_Wide_String)
887   is
888   begin
889      Wide_Wide_String_Ops.Write (Strm, Item, Block_IO);
890   end Wide_Wide_String_Write_Blk_IO;
891
892end System.Strings.Stream_Ops;
893