OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgfortran/] [intrinsics/] [iso_c_generated_procs.c] - Blame information for rev 757

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 733 jeremybenn
/* Implementation of the ISO_C_BINDING library helper generated functions.
2
   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
3
   Contributed by Christopher Rickett.
4
 
5
This file is part of the GNU Fortran 95 runtime library (libgfortran).
6
 
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.
11
 
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.
16
 
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.
20
 
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/>.  */
25
 
26
 
27
#include "libgfortran.h"
28
#include "iso_c_binding.h"
29
 
30
 
31
/* TODO: This file needs to be finished so that a function is provided
32
   for all possible type/kind combinations!  */
33
 
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
38
 
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
43
 
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
48
 
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
53
 
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
58
 
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
63
 
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
68
 
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
73
 
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
78
 
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
83
 
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
88
 
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
93
 
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
98
 
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
103
 
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
108
 
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
113
 
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
118
 
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
123
 
124
 
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.  */
134
 
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)
139
{
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));
144
}
145
#endif
146
 
147
 
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.  */
157
 
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)
162
{
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));
167
}
168
#endif
169
 
170
 
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.  */
176
 
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)
181
{
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));
186
}
187
#endif
188
 
189
 
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.  */
195
 
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)
200
{
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));
205
}
206
#endif
207
 
208
 
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.  */
218
 
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)
223
{
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));
228
}
229
#endif
230
 
231
 
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.  */
237
 
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)
242
{
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));
247
}
248
#endif
249
 
250
 
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.  */
256
 
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)
261
{
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));
266
}
267
#endif
268
 
269
 
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.  */
275
 
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)
280
{
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));
285
}
286
#endif
287
 
288
 
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.  */
294
 
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)
299
{
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));
304
}
305
#endif
306
 
307
 
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.  */
313
 
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)
318
{
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));
323
}
324
#endif
325
 
326
 
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.  */
332
 
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)
337
{
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));
342
}
343
#endif
344
 
345
 
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.  */
351
 
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)
356
{
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));
361
}
362
#endif
363
 
364
 
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.  */
370
 
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)
375
{
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));
380
}
381
#endif
382
 
383
 
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.  */
387
 
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)
392
{
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));
397
}
398
#endif
399
 
400
 
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.  */
404
 
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)
409
{
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));
414
}
415
#endif
416
 
417
 
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.  */
421
 
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)
426
{
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));
431
}
432
#endif
433
 
434
 
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.  */
438
 
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)
443
{
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));
448
}
449
#endif
450
 
451
 
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.  */
455
 
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)
460
{
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));
465
}
466
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.