File: modules_15c.c

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 (195 lines) | stat: -rw-r--r-- 3,498 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
#include <string.h>

#include "modules_15c.h"

int f_int_float(int *a, float *b) {
    return *a + *b;
}

int f_int_double(int *a, double *b) {
    return *a + *b;
}

int f_int_float_complex(int *a, float_complex_t *b) {
    return *a + crealf(*b) + cimagf(*b);
}

int f_int_double_complex(int *a, double_complex_t *b) {
    return *a + creal(*b) + cimag(*b);
}

int f_int_float_complex_value(int a, float_complex_t b) {
    return a + crealf(b) + cimagf(b);
}

int f_int_double_complex_value(int a, double_complex_t b) {
    return a + creal(b) + cimag(b);
}

float_complex_t f_float_complex_value_return(float_complex_t b) {
    float_complex_t r;
#if _WIN32
    r = _FCmulcr(b, 2.0);
#else
    r = b * 2;
#endif
    return r;
}

double_complex_t f_double_complex_value_return(double_complex_t b) {
    double_complex_t r;
#if _WIN32
    r = _Cmulcr(b, 2.0);
#else
    r = b * 2;
#endif
    return r;
}

int f_int_float_value(int a, float b) {
    return a + b;
}

int f_int_double_value(int a, double b) {
    return a + b;
}

int f_int_intarray(int n, int *b) {
    int i;
    int s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    return s;
}

float f_int_floatarray(int n, float *b) {
    int i;
    float s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    return s;
}

double f_int_doublearray(int n, double *b) {
    int i;
    double s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    return s;
}

float f_int_floatarray_star(int n, float *b) {
    int i;
    float s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    return s;
}

// --------------------------------------------------------------------

void sub_int_float(int *a, float *b, int *r) {
    *r = *a + *b;
}

void sub_int_double(int *a, double *b, int *r) {
    *r = *a + *b;
}

void sub_int_float_complex(int *a, float_complex_t *b, int *r) {
    *r = *a + crealf(*b) + cimagf(*b);
}

void sub_int_double_complex(int *a, double_complex_t *b, int *r) {
    *r = *a + creal(*b) + cimag(*b);
}

void sub_int_float_value(int a, float b, int *r) {
    *r = a + b;
}

void sub_int_double_value(int a, double b, int *r) {
    *r = a + b;
}

void sub_int_float_complex_value(int a, float_complex_t b, int *r) {
    *r = a + crealf(b) + cimagf(b);
}

void sub_int_double_complex_value(int a, double_complex_t b, int *r) {
    *r = a + creal(b) + cimag(b);
}

void sub_int_intarray(int n, int *b, int *r) {
    int i;
    int s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    *r = s;
}

void sub_int_floatarray(int n, float *b, float *r) {
    int i;
    float s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    *r = s;
}

void sub_int_doublearray(int n, double *b, double *r) {
    int i;
    double s;
    s = 0;
    for (i=0; i < n; i++) {
        s += b[i];
    }
    *r = s;
}

int f_string(char *s) {
    return strlen(s);
}

int32_t call_fortran_i32(int32_t i) {
    return fortran_i32(&i);
}

int32_t call_fortran_i32_value(int32_t i) {
    return fortran_i32_value(i);
}

int64_t call_fortran_i64(int64_t i) {
    return fortran_i64(&i);
}

int64_t call_fortran_i64_value(int64_t i) {
    return fortran_i64_value(i);
}

float call_fortran_f32(float i) {
    return fortran_f32(&i);
}

float call_fortran_f32_value(float i) {
    return fortran_f32_value(i);
}

double call_fortran_f64(double i) {
    return fortran_f64(&i);
}

double call_fortran_f64_value(double i) {
    return fortran_f64_value(i);
}