[AArch64] Map frint intrinsics to standard pattern names directly.
[official-gcc.git] / libgfortran / intrinsics / iso_c_generated_procs.c
blob420c488b1991c947a551ebdf3196c0a63990c31f
1 /* Implementation of the ISO_C_BINDING library helper generated functions.
2 Copyright (C) 2007-2013 Free Software Foundation, Inc.
3 Contributed by Christopher Rickett.
5 This file is part of the GNU Fortran 95 runtime library (libgfortran).
7 Libgfortran is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 Libgfortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
27 #include "libgfortran.h"
28 #include "iso_c_binding.h"
31 /* TODO: This file needs to be finished so that a function is provided
32 for all possible type/kind combinations! */
34 #ifdef HAVE_GFC_INTEGER_1
35 void ISO_C_BINDING_PREFIX (c_f_pointer_i1) (void *, gfc_array_void *,
36 const array_t *);
37 #endif
39 #ifdef HAVE_GFC_INTEGER_2
40 void ISO_C_BINDING_PREFIX (c_f_pointer_i2) (void *, gfc_array_void *,
41 const array_t *);
42 #endif
44 #ifdef HAVE_GFC_INTEGER_4
45 void ISO_C_BINDING_PREFIX (c_f_pointer_i4) (void *, gfc_array_void *,
46 const array_t *);
47 #endif
49 #ifdef HAVE_GFC_INTEGER_8
50 void ISO_C_BINDING_PREFIX (c_f_pointer_i8) (void *, gfc_array_void *,
51 const array_t *);
52 #endif
54 #ifdef HAVE_GFC_INTEGER_16
55 void ISO_C_BINDING_PREFIX (c_f_pointer_i16) (void *, gfc_array_void *,
56 const array_t *);
57 #endif
59 #ifdef HAVE_GFC_REAL_4
60 void ISO_C_BINDING_PREFIX (c_f_pointer_r4) (void *, gfc_array_void *,
61 const array_t *);
62 #endif
64 #ifdef HAVE_GFC_REAL_8
65 void ISO_C_BINDING_PREFIX (c_f_pointer_r8) (void *, gfc_array_void *,
66 const array_t *);
67 #endif
69 #ifdef HAVE_GFC_REAL_10
70 void ISO_C_BINDING_PREFIX (c_f_pointer_r10) (void *, gfc_array_void *,
71 const array_t *);
72 #endif
74 #ifdef HAVE_GFC_REAL_16
75 void ISO_C_BINDING_PREFIX (c_f_pointer_r16) (void *, gfc_array_void *,
76 const array_t *);
77 #endif
79 #ifdef HAVE_GFC_COMPLEX_4
80 void ISO_C_BINDING_PREFIX (c_f_pointer_c4) (void *, gfc_array_void *,
81 const array_t *);
82 #endif
84 #ifdef HAVE_GFC_COMPLEX_8
85 void ISO_C_BINDING_PREFIX (c_f_pointer_c8) (void *, gfc_array_void *,
86 const array_t *);
87 #endif
89 #ifdef HAVE_GFC_COMPLEX_10
90 void ISO_C_BINDING_PREFIX (c_f_pointer_c10) (void *, gfc_array_void *,
91 const array_t *);
92 #endif
94 #ifdef HAVE_GFC_COMPLEX_16
95 void ISO_C_BINDING_PREFIX (c_f_pointer_c16) (void *, gfc_array_void *,
96 const array_t *);
97 #endif
99 #ifdef GFC_DEFAULT_CHAR
100 void ISO_C_BINDING_PREFIX (c_f_pointer_s0) (void *, gfc_array_void *,
101 const array_t *);
102 #endif
104 #ifdef HAVE_GFC_LOGICAL_1
105 void ISO_C_BINDING_PREFIX (c_f_pointer_l1) (void *, gfc_array_void *,
106 const array_t *);
107 #endif
109 #ifdef HAVE_GFC_LOGICAL_2
110 void ISO_C_BINDING_PREFIX (c_f_pointer_l2) (void *, gfc_array_void *,
111 const array_t *);
112 #endif
114 #ifdef HAVE_GFC_LOGICAL_4
115 void ISO_C_BINDING_PREFIX (c_f_pointer_l4) (void *, gfc_array_void *,
116 const array_t *);
117 #endif
119 #ifdef HAVE_GFC_LOGICAL_8
120 void ISO_C_BINDING_PREFIX (c_f_pointer_l8) (void *, gfc_array_void *,
121 const array_t *);
122 #endif
125 #ifdef HAVE_GFC_INTEGER_1
126 /* Set the given Fortran pointer, 'f_ptr_out', to point to the given C
127 address, 'c_ptr_in'. The Fortran pointer is of type integer and
128 kind=1. The function c_f_pointer is used to set up the pointer
129 descriptor. shape is a one-dimensional array of integers
130 specifying the upper bounds of the array pointed to by the given C
131 address, if applicable. 'shape' is an optional parameter in
132 Fortran, so if the user does not provide it, it will come in here
133 as NULL. */
135 void
136 ISO_C_BINDING_PREFIX (c_f_pointer_i1) (void *c_ptr_in,
137 gfc_array_void *f_ptr_out,
138 const array_t *shape)
140 /* Here we have an integer(kind=1). */
141 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
142 (int) BT_INTEGER,
143 (int) sizeof (GFC_INTEGER_1));
145 #endif
148 #ifdef HAVE_GFC_INTEGER_2
149 /* Set the given Fortran pointer, 'f_ptr_out', to point to the given C
150 address, 'c_ptr_in'. The Fortran pointer is of type integer and
151 kind=2. The function c_f_pointer is used to set up the pointer
152 descriptor. shape is a one-dimensional array of integers
153 specifying the upper bounds of the array pointed to by the given C
154 address, if applicable. 'shape' is an optional parameter in
155 Fortran, so if the user does not provide it, it will come in here
156 as NULL. */
158 void
159 ISO_C_BINDING_PREFIX (c_f_pointer_i2) (void *c_ptr_in,
160 gfc_array_void *f_ptr_out,
161 const array_t *shape)
163 /* Here we have an integer(kind=2). */
164 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
165 (int) BT_INTEGER,
166 (int) sizeof (GFC_INTEGER_2));
168 #endif
171 #ifdef HAVE_GFC_INTEGER_4
172 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
173 address, c_ptr_in. The Fortran pointer is of type integer and
174 kind=4. The function c_f_pointer is used to set up the pointer
175 descriptor. */
177 void
178 ISO_C_BINDING_PREFIX (c_f_pointer_i4) (void *c_ptr_in,
179 gfc_array_void *f_ptr_out,
180 const array_t *shape)
182 /* Here we have an integer(kind=4). */
183 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
184 (int) BT_INTEGER,
185 (int) sizeof (GFC_INTEGER_4));
187 #endif
190 #ifdef HAVE_GFC_INTEGER_8
191 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
192 address, c_ptr_in. The Fortran pointer is of type integer and
193 kind=8. The function c_f_pointer is used to set up the pointer
194 descriptor. */
196 void
197 ISO_C_BINDING_PREFIX (c_f_pointer_i8) (void *c_ptr_in,
198 gfc_array_void *f_ptr_out,
199 const array_t *shape)
201 /* Here we have an integer(kind=8). */
202 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
203 (int) BT_INTEGER,
204 (int) sizeof (GFC_INTEGER_8));
206 #endif
209 #ifdef HAVE_GFC_INTEGER_16
210 /* Set the given Fortran pointer, 'f_ptr_out', to point to the given C
211 address, 'c_ptr_in'. The Fortran pointer is of type integer and
212 kind=16. The function c_f_pointer is used to set up the pointer
213 descriptor. shape is a one-dimensional array of integers
214 specifying the upper bounds of the array pointed to by the given C
215 address, if applicable. 'shape' is an optional parameter in
216 Fortran, so if the user does not provide it, it will come in here
217 as NULL. */
219 void
220 ISO_C_BINDING_PREFIX (c_f_pointer_i16) (void *c_ptr_in,
221 gfc_array_void *f_ptr_out,
222 const array_t *shape)
224 /* Here we have an integer(kind=16). */
225 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
226 (int) BT_INTEGER,
227 (int) sizeof (GFC_INTEGER_16));
229 #endif
232 #ifdef HAVE_GFC_REAL_4
233 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
234 address, c_ptr_in. The Fortran pointer is of type real and
235 kind=4. The function c_f_pointer is used to set up the pointer
236 descriptor. */
238 void
239 ISO_C_BINDING_PREFIX (c_f_pointer_r4) (void *c_ptr_in,
240 gfc_array_void *f_ptr_out,
241 const array_t *shape)
243 /* Here we have an real(kind=4). */
244 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
245 (int) BT_REAL,
246 (int) sizeof (GFC_REAL_4));
248 #endif
251 #ifdef HAVE_GFC_REAL_8
252 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
253 address, c_ptr_in. The Fortran pointer is of type real and
254 kind=8. The function c_f_pointer is used to set up the pointer
255 descriptor. */
257 void
258 ISO_C_BINDING_PREFIX (c_f_pointer_r8) (void *c_ptr_in,
259 gfc_array_void *f_ptr_out,
260 const array_t *shape)
262 /* Here we have an real(kind=8). */
263 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
264 (int) BT_REAL,
265 (int) sizeof (GFC_REAL_8));
267 #endif
270 #ifdef HAVE_GFC_REAL_10
271 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
272 address, c_ptr_in. The Fortran pointer is of type real and
273 kind=10. The function c_f_pointer is used to set up the pointer
274 descriptor. */
276 void
277 ISO_C_BINDING_PREFIX (c_f_pointer_r10) (void *c_ptr_in,
278 gfc_array_void *f_ptr_out,
279 const array_t *shape)
281 /* Here we have an real(kind=10). */
282 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
283 (int) BT_REAL,
284 (int) sizeof (GFC_REAL_10));
286 #endif
289 #ifdef HAVE_GFC_REAL_16
290 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
291 address, c_ptr_in. The Fortran pointer is of type real and
292 kind=16. The function c_f_pointer is used to set up the pointer
293 descriptor. */
295 void
296 ISO_C_BINDING_PREFIX (c_f_pointer_r16) (void *c_ptr_in,
297 gfc_array_void *f_ptr_out,
298 const array_t *shape)
300 /* Here we have an real(kind=16). */
301 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
302 (int) BT_REAL,
303 (int) sizeof (GFC_REAL_16));
305 #endif
308 #ifdef HAVE_GFC_COMPLEX_4
309 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
310 address, c_ptr_in. The Fortran pointer is of type complex and
311 kind=4. The function c_f_pointer is used to set up the pointer
312 descriptor. */
314 void
315 ISO_C_BINDING_PREFIX (c_f_pointer_c4) (void *c_ptr_in,
316 gfc_array_void *f_ptr_out,
317 const array_t *shape)
319 /* Here we have an complex(kind=4). */
320 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
321 (int) BT_COMPLEX,
322 (int) sizeof (GFC_COMPLEX_4));
324 #endif
327 #ifdef HAVE_GFC_COMPLEX_8
328 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
329 address, c_ptr_in. The Fortran pointer is of type complex and
330 kind=8. The function c_f_pointer is used to set up the pointer
331 descriptor. */
333 void
334 ISO_C_BINDING_PREFIX (c_f_pointer_c8) (void *c_ptr_in,
335 gfc_array_void *f_ptr_out,
336 const array_t *shape)
338 /* Here we have an complex(kind=8). */
339 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
340 (int) BT_COMPLEX,
341 (int) sizeof (GFC_COMPLEX_8));
343 #endif
346 #ifdef HAVE_GFC_COMPLEX_10
347 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
348 address, c_ptr_in. The Fortran pointer is of type complex and
349 kind=10. The function c_f_pointer is used to set up the pointer
350 descriptor. */
352 void
353 ISO_C_BINDING_PREFIX (c_f_pointer_c10) (void *c_ptr_in,
354 gfc_array_void *f_ptr_out,
355 const array_t *shape)
357 /* Here we have an complex(kind=10). */
358 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
359 (int) BT_COMPLEX,
360 (int) sizeof (GFC_COMPLEX_10));
362 #endif
365 #ifdef HAVE_GFC_COMPLEX_16
366 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
367 address, c_ptr_in. The Fortran pointer is of type complex and
368 kind=16. The function c_f_pointer is used to set up the pointer
369 descriptor. */
371 void
372 ISO_C_BINDING_PREFIX (c_f_pointer_c16) (void *c_ptr_in,
373 gfc_array_void *f_ptr_out,
374 const array_t *shape)
376 /* Here we have an complex(kind=16). */
377 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
378 (int) BT_COMPLEX,
379 (int) sizeof (GFC_COMPLEX_16));
381 #endif
384 #ifdef GFC_DEFAULT_CHAR
385 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
386 address, c_ptr_in. The Fortran pointer is of type character. */
388 void
389 ISO_C_BINDING_PREFIX (c_f_pointer_s0) (void *c_ptr_in,
390 gfc_array_void *f_ptr_out,
391 const array_t *shape)
393 /* Here we have a character string of len=1. */
394 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
395 (int) BT_CHARACTER,
396 (int) sizeof (char));
398 #endif
401 #ifdef HAVE_GFC_LOGICAL_1
402 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
403 address, c_ptr_in. The Fortran pointer is of type logical, kind=1. */
405 void
406 ISO_C_BINDING_PREFIX (c_f_pointer_l1) (void *c_ptr_in,
407 gfc_array_void *f_ptr_out,
408 const array_t *shape)
410 /* Here we have a logical of kind=1. */
411 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
412 (int) BT_LOGICAL,
413 (int) sizeof (GFC_LOGICAL_1));
415 #endif
418 #ifdef HAVE_GFC_LOGICAL_2
419 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
420 address, c_ptr_in. The Fortran pointer is of type logical, kind=2. */
422 void
423 ISO_C_BINDING_PREFIX (c_f_pointer_l2) (void *c_ptr_in,
424 gfc_array_void *f_ptr_out,
425 const array_t *shape)
427 /* Here we have a logical of kind=2. */
428 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
429 (int) BT_LOGICAL,
430 (int) sizeof (GFC_LOGICAL_2));
432 #endif
435 #ifdef HAVE_GFC_LOGICAL_4
436 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
437 address, c_ptr_in. The Fortran pointer is of type logical, kind=4. */
439 void
440 ISO_C_BINDING_PREFIX (c_f_pointer_l4) (void *c_ptr_in,
441 gfc_array_void *f_ptr_out,
442 const array_t *shape)
444 /* Here we have a logical of kind=4. */
445 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
446 (int) BT_LOGICAL,
447 (int) sizeof (GFC_LOGICAL_4));
449 #endif
452 #ifdef HAVE_GFC_LOGICAL_8
453 /* Set the given Fortran pointer, f_ptr_out, to point to the given C
454 address, c_ptr_in. The Fortran pointer is of type logical, kind=8. */
456 void
457 ISO_C_BINDING_PREFIX (c_f_pointer_l8) (void *c_ptr_in,
458 gfc_array_void *f_ptr_out,
459 const array_t *shape)
461 /* Here we have a logical of kind=8. */
462 ISO_C_BINDING_PREFIX (c_f_pointer) (c_ptr_in, f_ptr_out, shape,
463 (int) BT_LOGICAL,
464 (int) sizeof (GFC_LOGICAL_8));
466 #endif