File: modules_15b.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (348 lines) | stat: -rw-r--r-- 11,594 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
module modules_15b
use iso_c_binding, only: c_int, c_long_long, c_float, c_double, c_char, &
    c_null_char, c_float_complex, c_double_complex, c_int32_t, c_int64_t
implicit none

interface
    ! int f_int_float(int *a, float *b)
    integer(c_int) function f_int_float(a, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), intent(in) :: a
    real(c_float), intent(in) :: b
    end function

    ! int f_int_double(int *a, double *b)
    integer(c_int) function f_int_double(a, b) result(r) bind(c)
    import :: c_int, c_double
    integer(c_int), intent(in) :: a
    real(c_double), intent(in) :: b
    end function

    ! int f_int_float_complex(int *a, float_complex_t *b)
    integer(c_int) function f_int_float_complex(a, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), intent(in) :: a
    complex(c_float), intent(in) :: b
    end function

    ! int f_int_double_complex(int *a, double_complex_t *b)
    integer(c_int) function f_int_double_complex(a, b) result(r) bind(c)
    import :: c_int, c_double
    integer(c_int), intent(in) :: a
    complex(c_double), intent(in) :: b
    end function

    integer(c_int) function f_int_float_complex2(a, b) result(r) &
            bind(c, name="f_int_float_complex")
    import :: c_int, c_float_complex
    integer(c_int), intent(in) :: a
    complex(c_float_complex), intent(in) :: b
    end function

    ! int f_int_double_complex(int *a, double_complex_t *b)
    integer(c_int) function f_int_double_complex2(a, b) result(r) &
            bind(c, name="f_int_double_complex")
    import :: c_int, c_double_complex
    integer(c_int), intent(in) :: a
    complex(c_double_complex), intent(in) :: b
    end function

    ! int f_int_float_complex_value(int a, float_complex_t b)
    integer(c_int) function f_int_float_complex_value(a, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: a
    complex(c_float), value, intent(in) :: b
    end function

    ! int f_int_double_complex_value(int a, double_complex_t b)
    integer(c_int) function f_int_double_complex_value(a, b) result(r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    complex(c_double), value, intent(in) :: b
    end function

    ! float_complex_t f_float_complex_value_return(float_complex_t b)
    complex(c_float) function f_float_complex_value_return(b) result(r) bind(c)
    import :: c_float
    complex(c_float), value, intent(in) :: b
    end function

    ! double_complex_t f_double_complex_value_return(double_complex_t b)
    complex(c_double) function f_double_complex_value_return(b) result(r)bind(c)
    import :: c_double
    complex(c_double), value, intent(in) :: b
    end function

    ! int f_int_float_value(int a, float b)
    integer(c_int) function f_int_float_value(a, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: a
    real(c_float), value, intent(in) :: b
    end function

    ! int f_int_double_value(int a, double b)
    integer(c_int) function f_int_double_value(a, b) result(r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    real(c_double), value, intent(in) :: b
    end function

    ! int f_int_intarray(int n, int *b)
    integer(c_int) function f_int_intarray(n, b) result(r) bind(c)
    import :: c_int
    integer(c_int), value, intent(in) :: n
    integer(c_int), intent(in) :: b(n)
    end function

    ! float f_int_floatarray(int n, float *b)
    real(c_float) function f_int_floatarray(n, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: n
    real(c_float), intent(in) :: b(n)
    end function

    ! double f_int_doublearray(int n, double *b)
    real(c_double) function f_int_doublearray(n, b) result(r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: n
    real(c_double), intent(in) :: b(n)
    end function

    ! int f_int_intarray(int n, int *b)
    integer(c_int) function f_int_intarray_star(n, b) result(r) &
            bind(c, name="f_int_intarray")
    import :: c_int
    integer(c_int), value, intent(in) :: n
    integer(c_int), intent(in) :: b(*)
    end function

    ! float f_int_floatarray_star(int n, float *b)
    real(c_float) function f_int_floatarray_star(n, b) result(r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: n
    real(c_float), intent(in) :: b(*)
    end function

    ! double f_int_doublearray(int n, double *b)
    real(c_double) function f_int_doublearray_star(n, b) result(r) &
            bind(c, name="f_int_doublearray")
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: n
    real(c_double), intent(in) :: b(*)
    end function

    ! int f_int_double_value(int a, double b)
    integer(c_int) function f_int_double_value_name(a, b) result(r) &
            bind(c, name="f_int_double_value")
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    real(c_double), value, intent(in) :: b
    end function

!----------------------------------------------------------------------------

    ! void sub_int_float(int *a, float *b, int *r)
    subroutine sub_int_float(a, b, r) bind(c)
    import :: c_int, c_float
    integer(c_int), intent(in) :: a
    real(c_float), intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_double(int *a, double *b, int *r)
    subroutine sub_int_double(a, b, r) bind(c)
    import :: c_int, c_double
    integer(c_int), intent(in) :: a
    real(c_double), intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_float_complex(int *a, float_complex_t *b, int *r)
    subroutine sub_int_float_complex(a, b, r) bind(c)
    import :: c_int, c_float
    integer(c_int), intent(in) :: a
    complex(c_float), intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_double_complex(int *a, double_complex_t *b, int *r)
    subroutine sub_int_double_complex(a, b, r) bind(c)
    import :: c_int, c_double
    integer(c_int), intent(in) :: a
    complex(c_double), intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_float_value(int a, float b, int *r)
    subroutine sub_int_float_value(a, b, r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: a
    real(c_float), value, intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_double_value(int a, double b, int *r)
    subroutine sub_int_double_value(a, b, r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    real(c_double), value, intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_float_complex_value(int a, float_complex_t b, int *r)
    subroutine sub_int_float_complex_value(a, b, r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: a
    complex(c_float), value, intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_double_complex_value(int a, double_complex_t b, int *r)
    subroutine sub_int_double_complex_value(a, b, r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    complex(c_double), value, intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_intarray(int n, int *b, int *r)
    subroutine sub_int_intarray(n, b, r) bind(c)
    import :: c_int
    integer(c_int), value, intent(in) :: n
    integer(c_int), intent(in) :: b(n)
    integer(c_int), intent(out) :: r
    end subroutine

    ! void sub_int_floatarray(int n, float *b, float *r)
    subroutine sub_int_floatarray(n, b, r) bind(c)
    import :: c_int, c_float
    integer(c_int), value, intent(in) :: n
    real(c_float), intent(in) :: b(n)
    real(c_float), intent(out) :: r
    end subroutine

    ! void sub_int_doublearray(int n, double *b, double *r)
    subroutine sub_int_doublearray(n, b, r) bind(c)
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: n
    real(c_double), intent(in) :: b(n)
    real(c_double), intent(out) :: r
    end subroutine

    ! void sub_int_double_value(int a, double b, int *r)
    subroutine sub_int_double_value_name(a, b, r) &
        bind(c, name="sub_int_double_value")
    import :: c_int, c_double
    integer(c_int), value, intent(in) :: a
    real(c_double), value, intent(in) :: b
    integer(c_int), intent(out) :: r
    end subroutine

    ! int f_string(char *s)
    integer(c_int) function f_string0(s) result(r) bind(c, name="f_string")
    import :: c_int, c_char
    character(len=1, kind=c_char), intent(in) :: s(*)
    end function

    integer(c_int) function call_fortran_i32(i) result(r) bind(c)
    import :: c_int
    integer(c_int), value, intent(in) :: i
    end function

    integer(c_int) function call_fortran_i32_value(i) result(r) bind(c)
    import :: c_int
    integer(c_int), value, intent(in) :: i
    end function

    integer(c_int32_t) function call_fortran_i32_value2(i) result(r) &
            bind(c, name="call_fortran_i32_value")
    import :: c_int32_t
    integer(c_int32_t), value, intent(in) :: i
    end function

    integer(c_long_long) function call_fortran_i64(i) result(r) bind(c)
    import :: c_long_long
    integer(c_long_long), value, intent(in) :: i
    end function

    integer(c_long_long) function call_fortran_i64_value(i) result(r) bind(c)
    import :: c_long_long
    integer(c_long_long), value, intent(in) :: i
    end function

    integer(c_int64_t) function call_fortran_i64_value2(i) result(r) &
            bind(c, name="call_fortran_i64_value")
    import :: c_int64_t
    integer(c_int64_t), value, intent(in) :: i
    end function

    real(c_float) function call_fortran_f32(i) result(r) bind(c)
    import :: c_float
    real(c_float), value, intent(in) :: i
    end function

    real(c_float) function call_fortran_f32_value(i) result(r) bind(c)
    import :: c_float
    real(c_float), value, intent(in) :: i
    end function

    real(c_double) function call_fortran_f64(i) result(r) bind(c)
    import :: c_double
    real(c_double), value, intent(in) :: i
    end function

    real(c_double) function call_fortran_f64_value(i) result(r) bind(c)
    import :: c_double
    real(c_double), value, intent(in) :: i
    end function

end interface

contains

integer function f_string(s) result(r)
character(*), intent(in) :: s
r = f_string0(s // c_null_char)
end function

integer(c_int) function fortran_i32(i) result(r) bind(c)
integer(c_int), intent(in) :: i
r = i + 2
end function

integer(c_int) function fortran_i32_value(i) result(r) bind(c)
integer(c_int), value, intent(in) :: i
r = i + 2
end function

integer(c_long_long) function fortran_i64(i) result(r) bind(c)
integer(c_long_long), intent(in) :: i
r = i + 2
end function

integer(c_long_long) function fortran_i64_value(i) result(r) bind(c)
integer(c_long_long), value, intent(in) :: i
r = i + 2
end function

real(c_float) function fortran_f32(i) result(r) bind(c)
real(c_float), intent(in) :: i
r = i + 2.3_c_float
end function

real(c_float) function fortran_f32_value(i) result(r) bind(c)
real(c_float), value, intent(in) :: i
r = i + 2.3_c_float
end function

real(c_double) function fortran_f64(i) result(r) bind(c)
real(c_double), intent(in) :: i
r = i + 2.3_c_double
end function

real(c_double) function fortran_f64_value(i) result(r) bind(c)
real(c_double), value, intent(in) :: i
r = i + 2.3_c_double
end function

end module