Debian Codegraph @

gcc/ada/libgnat/s-stratt__cheri.adb

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . S T R E A M _ A T T R I B U T E S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-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 -- This is the CHERI variant of this package
33
34 with Ada.IO_Exceptions;
35 with Ada.Streams; use Ada.Streams;
36 with Ada.Unchecked_Conversion;
37 with System.Stream_Attributes.XDR;
38
39 package body System.Stream_Attributes is
40
41 XDR_Stream : constant Integer;
42 pragma Import (C, XDR_Stream, "__gl_xdr_stream");
43 -- This imported value is used to determine whether the build had the
44 -- binder switch "-xdr" present which enables XDR streaming and sets this
45 -- flag to 1.
46
47 function XDR_Support return Boolean is (XDR_Stream = 1);
48 pragma Inline (XDR_Support);
49 -- Return True if XDR streaming should be used. Note that 128-bit integers
50 -- are not supported by the XDR protocol and will raise Device_Error.
51
52 Err : exception renames Ada.IO_Exceptions.End_Error;
53 -- Exception raised if insufficient data read (note that the RM implies
54 -- that Data_Error might be the appropriate choice, but AI95-00132
55 -- decides with a binding interpretation that End_Error is preferred).
56
57 SU : constant := System.Storage_Unit;
58
59 subtype SEA is Ada.Streams.Stream_Element_Array;
60 subtype SEO is Ada.Streams.Stream_Element_Offset;
61
62 generic function UC renames Ada.Unchecked_Conversion;
63
64 -- Subtypes used to define Stream_Element_Array values that map
65 -- into the elementary types, using unchecked conversion.
66
67 Thin_Pointer_Size : constant := System.Address'Size;
68 Fat_Pointer_Size : constant := System.Address'Size * 2;
69
70 subtype S_AD is SEA (1 .. (Fat_Pointer_Size + SU - 1) / SU);
71 subtype S_AS is SEA (1 .. (Thin_Pointer_Size + SU - 1) / SU);
72 subtype S_B is SEA (1 .. (Boolean'Size + SU - 1) / SU);
73 subtype S_C is SEA (1 .. (Character'Size + SU - 1) / SU);
74 subtype S_F is SEA (1 .. (Float'Size + SU - 1) / SU);
75 subtype S_I is SEA (1 .. (Integer'Size + SU - 1) / SU);
76 subtype S_I24 is SEA (1 .. (Integer_24'Size + SU - 1) / SU);
77 subtype S_LF is SEA (1 .. (Long_Float'Size + SU - 1) / SU);
78 subtype S_LI is SEA (1 .. (Long_Integer'Size + SU - 1) / SU);
79 subtype S_LLF is SEA (1 .. (Long_Long_Float'Size + SU - 1) / SU);
80 subtype S_LLI is SEA (1 .. (Long_Long_Integer'Size + SU - 1) / SU);
81 subtype S_LLLI is SEA (1 .. (Long_Long_Long_Integer'Size + SU - 1) / SU);
82 subtype S_LLLU is
83 SEA (1 .. (UST.Long_Long_Long_Unsigned'Size + SU - 1) / SU);
84 subtype S_LLU is SEA (1 .. (UST.Long_Long_Unsigned'Size + SU - 1) / SU);
85 subtype S_LU is SEA (1 .. (UST.Long_Unsigned'Size + SU - 1) / SU);
86 subtype S_SF is SEA (1 .. (Short_Float'Size + SU - 1) / SU);
87 subtype S_SI is SEA (1 .. (Short_Integer'Size + SU - 1) / SU);
88 subtype S_SSI is SEA (1 .. (Short_Short_Integer'Size + SU - 1) / SU);
89 subtype S_SSU is SEA (1 .. (UST.Short_Short_Unsigned'Size + SU - 1) / SU);
90 subtype S_SU is SEA (1 .. (UST.Short_Unsigned'Size + SU - 1) / SU);
91 subtype S_U is SEA (1 .. (UST.Unsigned'Size + SU - 1) / SU);
92 subtype S_U24 is SEA (1 .. (Unsigned_24'Size + SU - 1) / SU);
93 subtype S_WC is SEA (1 .. (Wide_Character'Size + SU - 1) / SU);
94 subtype S_WWC is SEA (1 .. (Wide_Wide_Character'Size + SU - 1) / SU);
95
96 -- Unchecked conversions from the elementary type to the stream type
97
98 function From_AD is new UC (Fat_Pointer, S_AD);
99 function From_AS is new UC (Thin_Pointer, S_AS);
100 function From_F is new UC (Float, S_F);
101 function From_I is new UC (Integer, S_I);
102 function From_I24 is new UC (Integer_24, S_I24);
103 function From_LF is new UC (Long_Float, S_LF);
104 function From_LI is new UC (Long_Integer, S_LI);
105 function From_LLF is new UC (Long_Long_Float, S_LLF);
106 function From_LLI is new UC (Long_Long_Integer, S_LLI);
107 function From_LLLI is new UC (Long_Long_Long_Integer, S_LLLI);
108 function From_LLLU is new UC (UST.Long_Long_Long_Unsigned, S_LLLU);
109 function From_LLU is new UC (UST.Long_Long_Unsigned, S_LLU);
110 function From_LU is new UC (UST.Long_Unsigned, S_LU);
111 function From_SF is new UC (Short_Float, S_SF);
112 function From_SI is new UC (Short_Integer, S_SI);
113 function From_SSI is new UC (Short_Short_Integer, S_SSI);
114 function From_SSU is new UC (UST.Short_Short_Unsigned, S_SSU);
115 function From_SU is new UC (UST.Short_Unsigned, S_SU);
116 function From_U is new UC (UST.Unsigned, S_U);
117 function From_U24 is new UC (Unsigned_24, S_U24);
118 function From_WC is new UC (Wide_Character, S_WC);
119 function From_WWC is new UC (Wide_Wide_Character, S_WWC);
120
121 -- Unchecked conversions from the stream type to elementary type
122
123 function To_F is new UC (S_F, Float);
124 function To_I is new UC (S_I, Integer);
125 function To_I24 is new UC (S_I24, Integer_24);
126 function To_LF is new UC (S_LF, Long_Float);
127 function To_LI is new UC (S_LI, Long_Integer);
128 function To_LLF is new UC (S_LLF, Long_Long_Float);
129 function To_LLI is new UC (S_LLI, Long_Long_Integer);
130 function To_LLLI is new UC (S_LLLI, Long_Long_Long_Integer);
131 function To_LLLU is new UC (S_LLLU, UST.Long_Long_Long_Unsigned);
132 function To_LLU is new UC (S_LLU, UST.Long_Long_Unsigned);
133 function To_LU is new UC (S_LU, UST.Long_Unsigned);
134 function To_SF is new UC (S_SF, Short_Float);
135 function To_SI is new UC (S_SI, Short_Integer);
136 function To_SSI is new UC (S_SSI, Short_Short_Integer);
137 function To_SSU is new UC (S_SSU, UST.Short_Short_Unsigned);
138 function To_SU is new UC (S_SU, UST.Short_Unsigned);
139 function To_U is new UC (S_U, UST.Unsigned);
140 function To_U24 is new UC (S_U24, Unsigned_24);
141 function To_WC is new UC (S_WC, Wide_Character);
142 function To_WWC is new UC (S_WWC, Wide_Wide_Character);
143
144 -----------------
145 -- Block_IO_OK --
146 -----------------
147
148 function Block_IO_OK return Boolean is
149 begin
150 return not XDR_Support;
151 end Block_IO_OK;
152
153 ----------
154 -- I_AD --
155 ----------
156
157 function I_AD (Stream : not null access RST) return Fat_Pointer is
158 pragma Unreferenced (Stream);
159 begin
160 raise Program_Error with "Operation not supported on CHERI targets";
161
162 return Fat_Pointer'(Null_Address, Null_Address);
163 end I_AD;
164
165 ----------
166 -- I_AS --
167 ----------
168
169 function I_AS (Stream : not null access RST) return Thin_Pointer is
170 pragma Unreferenced (Stream);
171 begin
172 raise Program_Error with "Operation not supported on CHERI targets";
173
174 return Null_Address;
175 end I_AS;
176
177 ---------
178 -- I_B --
179 ---------
180
181 function I_B (Stream : not null access RST) return Boolean is
182 T : S_B;
183 L : SEO;
184
185 begin
186 if XDR_Support then
187 return XDR.I_B (Stream);
188 end if;
189
190 Ada.Streams.Read (Stream.all, T, L);
191
192 if L < T'Last then
193 raise Err;
194 else
195 return Boolean'Val (T (1));
196 end if;
197 end I_B;
198
199 ---------
200 -- I_C --
201 ---------
202
203 function I_C (Stream : not null access RST) return Character is
204 T : S_C;
205 L : SEO;
206
207 begin
208 if XDR_Support then
209 return XDR.I_C (Stream);
210 end if;
211
212 Ada.Streams.Read (Stream.all, T, L);
213
214 if L < T'Last then
215 raise Err;
216 else
217 return Character'Val (T (1));
218 end if;
219 end I_C;
220
221 ---------
222 -- I_F --
223 ---------
224
225 function I_F (Stream : not null access RST) return Float is
226 T : S_F;
227 L : SEO;
228
229 begin
230 if XDR_Support then
231 return XDR.I_F (Stream);
232 end if;
233
234 Ada.Streams.Read (Stream.all, T, L);
235
236 if L < T'Last then
237 raise Err;
238 else
239 return To_F (T);
240 end if;
241 end I_F;
242
243 ---------
244 -- I_I --
245 ---------
246
247 function I_I (Stream : not null access RST) return Integer is
248 T : S_I;
249 L : SEO;
250
251 begin
252 if XDR_Support then
253 return XDR.I_I (Stream);
254 end if;
255
256 Ada.Streams.Read (Stream.all, T, L);
257
258 if L < T'Last then
259 raise Err;
260 else
261 return To_I (T);
262 end if;
263 end I_I;
264
265 -----------
266 -- I_I24 --
267 -----------
268
269 function I_I24 (Stream : not null access RST) return Integer_24 is
270 T : S_I24;
271 L : SEO;
272
273 begin
274 if XDR_Support then
275 return XDR.I_I24 (Stream);
276 end if;
277
278 Ada.Streams.Read (Stream.all, T, L);
279
280 if L < T'Last then
281 raise Err;
282 else
283 return To_I24 (T);
284 end if;
285 end I_I24;
286
287 ----------
288 -- I_LF --
289 ----------
290
291 function I_LF (Stream : not null access RST) return Long_Float is
292 T : S_LF;
293 L : SEO;
294
295 begin
296 if XDR_Support then
297 return XDR.I_LF (Stream);
298 end if;
299
300 Ada.Streams.Read (Stream.all, T, L);
301
302 if L < T'Last then
303 raise Err;
304 else
305 return To_LF (T);
306 end if;
307 end I_LF;
308
309 ----------
310 -- I_LI --
311 ----------
312
313 function I_LI (Stream : not null access RST) return Long_Integer is
314 T : S_LI;
315 L : SEO;
316
317 begin
318 if XDR_Support then
319 return XDR.I_LI (Stream);
320 end if;
321
322 Ada.Streams.Read (Stream.all, T, L);
323
324 if L < T'Last then
325 raise Err;
326 else
327 return To_LI (T);
328 end if;
329 end I_LI;
330
331 -----------
332 -- I_LLF --
333 -----------
334
335 function I_LLF (Stream : not null access RST) return Long_Long_Float is
336 T : S_LLF;
337 L : SEO;
338
339 begin
340 if XDR_Support then
341 return XDR.I_LLF (Stream);
342 end if;
343
344 Ada.Streams.Read (Stream.all, T, L);
345
346 if L < T'Last then
347 raise Err;
348 else
349 return To_LLF (T);
350 end if;
351 end I_LLF;
352
353 -----------
354 -- I_LLI --
355 -----------
356
357 function I_LLI (Stream : not null access RST) return Long_Long_Integer is
358 T : S_LLI;
359 L : SEO;
360
361 begin
362 if XDR_Support then
363 return XDR.I_LLI (Stream);
364 end if;
365
366 Ada.Streams.Read (Stream.all, T, L);
367
368 if L < T'Last then
369 raise Err;
370 else
371 return To_LLI (T);
372 end if;
373 end I_LLI;
374
375 ------------
376 -- I_LLLI --
377 ------------
378
379 function I_LLLI (Stream : not null access RST) return Long_Long_Long_Integer
380 is
381 T : S_LLLI;
382 L : SEO;
383
384 begin
385 if XDR_Support then
386 raise Ada.IO_Exceptions.Device_Error;
387 end if;
388
389 Ada.Streams.Read (Stream.all, T, L);
390
391 if L < T'Last then
392 raise Err;
393 else
394 return To_LLLI (T);
395 end if;
396 end I_LLLI;
397
398 ------------
399 -- I_LLLU --
400 ------------
401
402 function I_LLLU
403 (Stream : not null access RST) return UST.Long_Long_Long_Unsigned
404 is
405 T : S_LLLU;
406 L : SEO;
407
408 begin
409 if XDR_Support then
410 raise Ada.IO_Exceptions.Device_Error;
411 end if;
412
413 Ada.Streams.Read (Stream.all, T, L);
414
415 if L < T'Last then
416 raise Err;
417 else
418 return To_LLLU (T);
419 end if;
420 end I_LLLU;
421
422 -----------
423 -- I_LLU --
424 -----------
425
426 function I_LLU
427 (Stream : not null access RST) return UST.Long_Long_Unsigned
428 is
429 T : S_LLU;
430 L : SEO;
431
432 begin
433 if XDR_Support then
434 return XDR.I_LLU (Stream);
435 end if;
436
437 Ada.Streams.Read (Stream.all, T, L);
438
439 if L < T'Last then
440 raise Err;
441 else
442 return To_LLU (T);
443 end if;
444 end I_LLU;
445
446 ----------
447 -- I_LU --
448 ----------
449
450 function I_LU (Stream : not null access RST) return UST.Long_Unsigned is
451 T : S_LU;
452 L : SEO;
453
454 begin
455 if XDR_Support then
456 return XDR.I_LU (Stream);
457 end if;
458
459 Ada.Streams.Read (Stream.all, T, L);
460
461 if L < T'Last then
462 raise Err;
463 else
464 return To_LU (T);
465 end if;
466 end I_LU;
467
468 ----------
469 -- I_SF --
470 ----------
471
472 function I_SF (Stream : not null access RST) return Short_Float is
473 T : S_SF;
474 L : SEO;
475
476 begin
477 if XDR_Support then
478 return XDR.I_SF (Stream);
479 end if;
480
481 Ada.Streams.Read (Stream.all, T, L);
482
483 if L < T'Last then
484 raise Err;
485 else
486 return To_SF (T);
487 end if;
488 end I_SF;
489
490 ----------
491 -- I_SI --
492 ----------
493
494 function I_SI (Stream : not null access RST) return Short_Integer is
495 T : S_SI;
496 L : SEO;
497
498 begin
499 if XDR_Support then
500 return XDR.I_SI (Stream);
501 end if;
502
503 Ada.Streams.Read (Stream.all, T, L);
504
505 if L < T'Last then
506 raise Err;
507 else
508 return To_SI (T);
509 end if;
510 end I_SI;
511
512 -----------
513 -- I_SSI --
514 -----------
515
516 function I_SSI (Stream : not null access RST) return Short_Short_Integer is
517 T : S_SSI;
518 L : SEO;
519
520 begin
521 if XDR_Support then
522 return XDR.I_SSI (Stream);
523 end if;
524
525 Ada.Streams.Read (Stream.all, T, L);
526
527 if L < T'Last then
528 raise Err;
529 else
530 return To_SSI (T);
531 end if;
532 end I_SSI;
533
534 -----------
535 -- I_SSU --
536 -----------
537
538 function I_SSU
539 (Stream : not null access RST) return UST.Short_Short_Unsigned
540 is
541 T : S_SSU;
542 L : SEO;
543
544 begin
545 if XDR_Support then
546 return XDR.I_SSU (Stream);
547 end if;
548
549 Ada.Streams.Read (Stream.all, T, L);
550
551 if L < T'Last then
552 raise Err;
553 else
554 return To_SSU (T);
555 end if;
556 end I_SSU;
557
558 ----------
559 -- I_SU --
560 ----------
561
562 function I_SU (Stream : not null access RST) return UST.Short_Unsigned is
563 T : S_SU;
564 L : SEO;
565
566 begin
567 if XDR_Support then
568 return XDR.I_SU (Stream);
569 end if;
570
571 Ada.Streams.Read (Stream.all, T, L);
572
573 if L < T'Last then
574 raise Err;
575 else
576 return To_SU (T);
577 end if;
578 end I_SU;
579
580 ---------
581 -- I_U --
582 ---------
583
584 function I_U (Stream : not null access RST) return UST.Unsigned is
585 T : S_U;
586 L : SEO;
587
588 begin
589 if XDR_Support then
590 return XDR.I_U (Stream);
591 end if;
592
593 Ada.Streams.Read (Stream.all, T, L);
594
595 if L < T'Last then
596 raise Err;
597 else
598 return To_U (T);
599 end if;
600 end I_U;
601
602 -----------
603 -- I_U24 --
604 -----------
605
606 function I_U24 (Stream : not null access RST) return Unsigned_24 is
607 T : S_U24;
608 L : SEO;
609
610 begin
611 if XDR_Support then
612 return XDR.I_U24 (Stream);
613 end if;
614
615 Ada.Streams.Read (Stream.all, T, L);
616
617 if L < T'Last then
618 raise Err;
619 else
620 return To_U24 (T);
621 end if;
622 end I_U24;
623
624 ----------
625 -- I_WC --
626 ----------
627
628 function I_WC (Stream : not null access RST) return Wide_Character is
629 T : S_WC;
630 L : SEO;
631
632 begin
633 if XDR_Support then
634 return XDR.I_WC (Stream);
635 end if;
636
637 Ada.Streams.Read (Stream.all, T, L);
638
639 if L < T'Last then
640 raise Err;
641 else
642 return To_WC (T);
643 end if;
644 end I_WC;
645
646 -----------
647 -- I_WWC --
648 -----------
649
650 function I_WWC (Stream : not null access RST) return Wide_Wide_Character is
651 T : S_WWC;
652 L : SEO;
653
654 begin
655 if XDR_Support then
656 return XDR.I_WWC (Stream);
657 end if;
658
659 Ada.Streams.Read (Stream.all, T, L);
660
661 if L < T'Last then
662 raise Err;
663 else
664 return To_WWC (T);
665 end if;
666 end I_WWC;
667
668 ----------
669 -- W_AD --
670 ----------
671
672 procedure W_AD (Stream : not null access RST; Item : Fat_Pointer) is
673 T : constant S_AD := From_AD (Item);
674 begin
675 if XDR_Support then
676 XDR.W_AD (Stream, Item);
677 return;
678 end if;
679
680 Ada.Streams.Write (Stream.all, T);
681 end W_AD;
682
683 ----------
684 -- W_AS --
685 ----------
686
687 procedure W_AS (Stream : not null access RST; Item : Thin_Pointer) is
688 T : constant S_AS := From_AS (Item);
689 begin
690 if XDR_Support then
691 XDR.W_AS (Stream, Item);
692 return;
693 end if;
694
695 Ada.Streams.Write (Stream.all, T);
696 end W_AS;
697
698 ---------
699 -- W_B --
700 ---------
701
702 procedure W_B (Stream : not null access RST; Item : Boolean) is
703 T : S_B;
704 begin
705 if XDR_Support then
706 XDR.W_B (Stream, Item);
707 return;
708 end if;
709
710 T (1) := Boolean'Pos (Item);
711 Ada.Streams.Write (Stream.all, T);
712 end W_B;
713
714 ---------
715 -- W_C --
716 ---------
717
718 procedure W_C (Stream : not null access RST; Item : Character) is
719 T : S_C;
720 begin
721 if XDR_Support then
722 XDR.W_C (Stream, Item);
723 return;
724 end if;
725
726 T (1) := Character'Pos (Item);
727 Ada.Streams.Write (Stream.all, T);
728 end W_C;
729
730 ---------
731 -- W_F --
732 ---------
733
734 procedure W_F (Stream : not null access RST; Item : Float) is
735 begin
736 if XDR_Support then
737 XDR.W_F (Stream, Item);
738 return;
739 end if;
740
741 Ada.Streams.Write (Stream.all, From_F (Item));
742 end W_F;
743
744 ---------
745 -- W_I --
746 ---------
747
748 procedure W_I (Stream : not null access RST; Item : Integer) is
749 begin
750 if XDR_Support then
751 XDR.W_I (Stream, Item);
752 return;
753 end if;
754
755 Ada.Streams.Write (Stream.all, From_I (Item));
756 end W_I;
757
758 -----------
759 -- W_I24 --
760 -----------
761
762 procedure W_I24 (Stream : not null access RST; Item : Integer_24) is
763 begin
764 if XDR_Support then
765 XDR.W_I24 (Stream, Item);
766 return;
767 end if;
768
769 Ada.Streams.Write (Stream.all, From_I24 (Item));
770 end W_I24;
771
772 ----------
773 -- W_LF --
774 ----------
775
776 procedure W_LF (Stream : not null access RST; Item : Long_Float) is
777 begin
778 if XDR_Support then
779 XDR.W_LF (Stream, Item);
780 return;
781 end if;
782
783 Ada.Streams.Write (Stream.all, From_LF (Item));
784 end W_LF;
785
786 ----------
787 -- W_LI --
788 ----------
789
790 procedure W_LI (Stream : not null access RST; Item : Long_Integer) is
791 begin
792 if XDR_Support then
793 XDR.W_LI (Stream, Item);
794 return;
795 end if;
796
797 Ada.Streams.Write (Stream.all, From_LI (Item));
798 end W_LI;
799
800 -----------
801 -- W_LLF --
802 -----------
803
804 procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float) is
805 begin
806 if XDR_Support then
807 XDR.W_LLF (Stream, Item);
808 return;
809 end if;
810
811 Ada.Streams.Write (Stream.all, From_LLF (Item));
812 end W_LLF;
813
814 -----------
815 -- W_LLI --
816 -----------
817
818 procedure W_LLI (Stream : not null access RST; Item : Long_Long_Integer) is
819 begin
820 if XDR_Support then
821 XDR.W_LLI (Stream, Item);
822 return;
823 end if;
824
825 Ada.Streams.Write (Stream.all, From_LLI (Item));
826 end W_LLI;
827
828 ------------
829 -- W_LLLI --
830 ------------
831
832 procedure W_LLLI
833 (Stream : not null access RST; Item : Long_Long_Long_Integer) is
834 begin
835 if XDR_Support then
836 raise Ada.IO_Exceptions.Device_Error;
837 end if;
838
839 Ada.Streams.Write (Stream.all, From_LLLI (Item));
840 end W_LLLI;
841
842 ------------
843 -- W_LLLU --
844 ------------
845
846 procedure W_LLLU
847 (Stream : not null access RST; Item : UST.Long_Long_Long_Unsigned)
848 is
849 begin
850 if XDR_Support then
851 raise Ada.IO_Exceptions.Device_Error;
852 end if;
853
854 Ada.Streams.Write (Stream.all, From_LLLU (Item));
855 end W_LLLU;
856
857 -----------
858 -- W_LLU --
859 -----------
860
861 procedure W_LLU
862 (Stream : not null access RST; Item : UST.Long_Long_Unsigned)
863 is
864 begin
865 if XDR_Support then
866 XDR.W_LLU (Stream, Item);
867 return;
868 end if;
869
870 Ada.Streams.Write (Stream.all, From_LLU (Item));
871 end W_LLU;
872
873 ----------
874 -- W_LU --
875 ----------
876
877 procedure W_LU (Stream : not null access RST; Item : UST.Long_Unsigned) is
878 begin
879 if XDR_Support then
880 XDR.W_LU (Stream, Item);
881 return;
882 end if;
883
884 Ada.Streams.Write (Stream.all, From_LU (Item));
885 end W_LU;
886
887 ----------
888 -- W_SF --
889 ----------
890
891 procedure W_SF (Stream : not null access RST; Item : Short_Float) is
892 begin
893 if XDR_Support then
894 XDR.W_SF (Stream, Item);
895 return;
896 end if;
897
898 Ada.Streams.Write (Stream.all, From_SF (Item));
899 end W_SF;
900
901 ----------
902 -- W_SI --
903 ----------
904
905 procedure W_SI (Stream : not null access RST; Item : Short_Integer) is
906 begin
907 if XDR_Support then
908 XDR.W_SI (Stream, Item);
909 return;
910 end if;
911
912 Ada.Streams.Write (Stream.all, From_SI (Item));
913 end W_SI;
914
915 -----------
916 -- W_SSI --
917 -----------
918
919 procedure W_SSI
920 (Stream : not null access RST; Item : Short_Short_Integer)
921 is
922 begin
923 if XDR_Support then
924 XDR.W_SSI (Stream, Item);
925 return;
926 end if;
927
928 Ada.Streams.Write (Stream.all, From_SSI (Item));
929 end W_SSI;
930
931 -----------
932 -- W_SSU --
933 -----------
934
935 procedure W_SSU
936 (Stream : not null access RST; Item : UST.Short_Short_Unsigned)
937 is
938 begin
939 if XDR_Support then
940 XDR.W_SSU (Stream, Item);
941 return;
942 end if;
943
944 Ada.Streams.Write (Stream.all, From_SSU (Item));
945 end W_SSU;
946
947 ----------
948 -- W_SU --
949 ----------
950
951 procedure W_SU (Stream : not null access RST; Item : UST.Short_Unsigned) is
952 begin
953 if XDR_Support then
954 XDR.W_SU (Stream, Item);
955 return;
956 end if;
957
958 Ada.Streams.Write (Stream.all, From_SU (Item));
959 end W_SU;
960
961 ---------
962 -- W_U --
963 ---------
964
965 procedure W_U (Stream : not null access RST; Item : UST.Unsigned) is
966 begin
967 if XDR_Support then
968 XDR.W_U (Stream, Item);
969 return;
970 end if;
971
972 Ada.Streams.Write (Stream.all, From_U (Item));
973 end W_U;
974
975 -----------
976 -- W_U24 --
977 -----------
978
979 procedure W_U24 (Stream : not null access RST; Item : Unsigned_24) is
980 begin
981 if XDR_Support then
982 XDR.W_U24 (Stream, Item);
983 return;
984 end if;
985
986 Ada.Streams.Write (Stream.all, From_U24 (Item));
987 end W_U24;
988
989 ----------
990 -- W_WC --
991 ----------
992
993 procedure W_WC (Stream : not null access RST; Item : Wide_Character) is
994 begin
995 if XDR_Support then
996 XDR.W_WC (Stream, Item);
997 return;
998 end if;
999
1000 Ada.Streams.Write (Stream.all, From_WC (Item));
1001 end W_WC;
1002
1003 -----------
1004 -- W_WWC --
1005 -----------
1006
1007 procedure W_WWC
1008 (Stream : not null access RST; Item : Wide_Wide_Character)
1009 is
1010 begin
1011 if XDR_Support then
1012 XDR.W_WWC (Stream, Item);
1013 return;
1014 end if;
1015
1016 Ada.Streams.Write (Stream.all, From_WWC (Item));
1017 end W_WWC;
1018
1019 end System.Stream_Attributes;