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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libgfortran/] [intrinsics/] [f2c_specifics.F90] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
!   Copyright 2002, 2005 Free Software Foundation, Inc.
2
!   Contributed by Tobias Schl"uter
3
!
4
!This file is part of the GNU Fortran 95 runtime library (libgfortran).
5
!
6
!GNU libgfortran is free software; you can redistribute it and/or
7
!modify it under the terms of the GNU General Public
8
!License as published by the Free Software Foundation; either
9
!version 2 of the License, or (at your option) any later version.
10
 
11
!In addition to the permissions in the GNU General Public License, the
12
!Free Software Foundation gives you unlimited permission to link the
13
!compiled version of this file into combinations with other programs,
14
!and to distribute those combinations without any restriction coming
15
!from the use of this file.  (The General Public License restrictions
16
!do apply in other respects; for example, they cover modification of
17
!the file, and distribution when not linked into a combine
18
!executable.)
19
!
20
!GNU libgfortran is distributed in the hope that it will be useful,
21
!but WITHOUT ANY WARRANTY; without even the implied warranty of
22
!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
!GNU General Public License for more details.
24
!
25
!You should have received a copy of the GNU General Public
26
!License along with libgfortran; see the file COPYING.  If not,
27
!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28
!Boston, MA 02110-1301, USA.
29
!
30
! Specifics for the intrinsics whose calling conventions change if
31
! -ff2c is used.
32
!
33
! There are two annoyances WRT the preprocessor:
34
!  - we're using -traditional-cpp, so we can't use the ## operator.
35
!  - macros expand to a single line, and Fortran lines can't be wider
36
!    than 132 characters, therefore we use two macros to split the lines
37
!
38
! The cases we need to implement are functions returning default REAL
39
! or COMPLEX.  The former need to return DOUBLE PRECISION instead of REAL,
40
! the latter become subroutines returning via a hidden first argument.
41
 
42
! one argument functions
43
#define REAL_HEAD(NAME) \
44
elemental function f2c_specific__/**/NAME/**/_r4 (parm) result(res);
45
 
46
#define REAL_BODY(NAME) \
47
  REAL, intent (in) :: parm; \
48
  DOUBLE PRECISION :: res; \
49
  res = NAME (parm); \
50
end function
51
 
52
#define COMPLEX_HEAD(NAME) \
53
subroutine f2c_specific__/**/NAME/**/_c4 (res, parm);
54
 
55
#define COMPLEX_BODY(NAME) \
56
  COMPLEX, intent (in) :: parm; \
57
  COMPLEX, intent (out) :: res; \
58
  res = NAME (parm); \
59
end subroutine
60
 
61
#define DCOMPLEX_HEAD(NAME) \
62
subroutine f2c_specific__/**/NAME/**/_c8 (res, parm);
63
 
64
#define DCOMPLEX_BODY(NAME) \
65
  DOUBLE COMPLEX, intent (in) :: parm; \
66
  DOUBLE COMPLEX, intent (out) :: res; \
67
  res = NAME (parm); \
68
end subroutine
69
 
70
REAL_HEAD(abs)
71
REAL_BODY(abs)
72
! abs is special in that the result is real
73
elemental function f2c_specific__abs_c4 (parm) result (res)
74
  COMPLEX, intent(in) :: parm
75
  DOUBLE PRECISION :: res
76
  res = abs(parm)
77
end function
78
 
79
REAL_HEAD(exp)
80
REAL_BODY(exp)
81
COMPLEX_HEAD(exp)
82
COMPLEX_BODY(exp)
83
DCOMPLEX_HEAD(exp)
84
DCOMPLEX_BODY(exp)
85
 
86
REAL_HEAD(log)
87
REAL_BODY(log)
88
COMPLEX_HEAD(log)
89
COMPLEX_BODY(log)
90
DCOMPLEX_HEAD(log)
91
DCOMPLEX_BODY(log)
92
 
93
REAL_HEAD(log10)
94
REAL_BODY(log10)
95
 
96
REAL_HEAD(sqrt)
97
REAL_BODY(sqrt)
98
COMPLEX_HEAD(sqrt)
99
COMPLEX_BODY(sqrt)
100
DCOMPLEX_HEAD(sqrt)
101
DCOMPLEX_BODY(sqrt)
102
 
103
REAL_HEAD(asin)
104
REAL_BODY(asin)
105
 
106
REAL_HEAD(acos)
107
REAL_BODY(acos)
108
 
109
REAL_HEAD(atan)
110
REAL_BODY(atan)
111
 
112
REAL_HEAD(sin)
113
REAL_BODY(sin)
114
COMPLEX_HEAD(sin)
115
COMPLEX_BODY(sin)
116
DCOMPLEX_HEAD(sin)
117
DCOMPLEX_BODY(sin)
118
 
119
REAL_HEAD(cos)
120
REAL_BODY(cos)
121
COMPLEX_HEAD(cos)
122
COMPLEX_BODY(cos)
123
DCOMPLEX_HEAD(cos)
124
DCOMPLEX_BODY(cos)
125
 
126
REAL_HEAD(tan)
127
REAL_BODY(tan)
128
 
129
REAL_HEAD(sinh)
130
REAL_BODY(sinh)
131
 
132
REAL_HEAD(cosh)
133
REAL_BODY(cosh)
134
 
135
REAL_HEAD(tanh)
136
REAL_BODY(tanh)
137
 
138
COMPLEX_HEAD(conjg)
139
COMPLEX_BODY(conjg)
140
DCOMPLEX_HEAD(conjg)
141
DCOMPLEX_BODY(conjg)
142
 
143
REAL_HEAD(aint)
144
REAL_BODY(aint)
145
 
146
REAL_HEAD(anint)
147
REAL_BODY(anint)
148
 
149
! two argument functions
150
#define REAL2_HEAD(NAME) \
151
elemental function f2c_specific__/**/NAME/**/_r4 (p1, p2) result(res);
152
 
153
#define REAL2_BODY(NAME) \
154
  REAL, intent (in) :: p1, p2; \
155
  DOUBLE PRECISION :: res; \
156
  res = NAME (p1, p2); \
157
end function
158
 
159
REAL2_HEAD(sign)
160
REAL2_BODY(sign)
161
 
162
REAL2_HEAD(dim)
163
REAL2_BODY(dim)
164
 
165
REAL2_HEAD(atan2)
166
REAL2_BODY(atan2)
167
 
168
REAL2_HEAD(mod)
169
REAL2_BODY(mod)

powered by: WebSVN 2.1.0

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