* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
[official-gcc.git] / gcc / ada / i-cstrea.adb
blob9d322d42906cb02d465a45f5056ae57eaace745c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I N T E R F A C E S . C _ S T R E A M S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1996-2001 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This is the default version which just calls the C versions directly
35 -- Note: the reason that we provide for specialization here is that on
36 -- some systems, notably VMS, we may need to worry about buffering.
38 with Unchecked_Conversion;
40 package body Interfaces.C_Streams is
42 ------------
43 -- fread --
44 ------------
46 function fread
47 (buffer : voids;
48 size : size_t;
49 count : size_t;
50 stream : FILEs)
51 return size_t
53 function C_fread
54 (buffer : voids;
55 size : size_t;
56 count : size_t;
57 stream : FILEs)
58 return size_t;
59 pragma Import (C, C_fread, "fread");
61 begin
62 return C_fread (buffer, size, count, stream);
63 end fread;
65 ------------
66 -- fread --
67 ------------
69 function fread
70 (buffer : voids;
71 index : size_t;
72 size : size_t;
73 count : size_t;
74 stream : FILEs)
75 return size_t
77 function C_fread
78 (buffer : voids;
79 size : size_t;
80 count : size_t;
81 stream : FILEs)
82 return size_t;
83 pragma Import (C, C_fread, "fread");
85 type Byte_Buffer is array (0 .. size_t'Last / 2 - 1) of Unsigned_8;
86 -- This should really be 0 .. size_t'last, but there is a problem
87 -- in gigi in handling such types (introduced in GCC 3 Sep 2001)
88 -- since the size in bytes of this array overflows ???
90 type Acc_Bytes is access all Byte_Buffer;
92 function To_Acc_Bytes is new Unchecked_Conversion (voids, Acc_Bytes);
94 begin
95 return C_fread
96 (To_Acc_Bytes (buffer) (index * size)'Address, size, count, stream);
97 end fread;
99 ------------
100 -- fwrite --
101 ------------
103 function fwrite
104 (buffer : voids;
105 size : size_t;
106 count : size_t;
107 stream : FILEs)
108 return size_t
110 function C_fwrite
111 (buffer : voids;
112 size : size_t;
113 count : size_t;
114 stream : FILEs)
115 return size_t;
116 pragma Import (C, C_fwrite, "fwrite");
118 begin
119 return C_fwrite (buffer, size, count, stream);
120 end fwrite;
122 -------------
123 -- setvbuf --
124 -------------
126 function setvbuf
127 (stream : FILEs;
128 buffer : chars;
129 mode : int;
130 size : size_t)
131 return int
133 function C_setvbuf
134 (stream : FILEs;
135 buffer : chars;
136 mode : int;
137 size : size_t)
138 return int;
139 pragma Import (C, C_setvbuf, "setvbuf");
141 begin
142 return C_setvbuf (stream, buffer, mode, size);
143 end setvbuf;
145 end Interfaces.C_Streams;