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