e6472bcede
* gfortran.h (gfc_options_t): Add flag_allow_leading_underscore. * lang.opt: Add -fallow-leading-underscore. * match.c (gfc_match_name): Allow leading underscore in symbol name if -fallow-leading-underscore is used. * symbol.c (gfc_get_default_type): Add special case for symbol names beginning with an underscore. * trans-decl.c (gfc_get_extern_function_decl, gfc_build_intrinsic_function_decls): Add _gfortran prefix to library symbols selected_int_kind, selected_real_kind and all specifics. * options.c (gfc_init_options, gfc_handle_option): Handle the new -fallow-leading-underscore option. * m4/misc_specifics.m4: Add _gfortran prefix to specific names. * m4/specific2.m4: Likewise. * m4/specific.m4: Likewise. * intrinsics/f2c_specifics.F90: Likewise. * intrinsics/selected_int_kind.f90: Add _gfortran prefix. * intrinsics/selected_real_kind.f90: Likewise. * intrinsics/dprod_r8.f90: Likewise. * Makefile.am: Add -fallow-leading-underscore to the gfor_specific_src files, as well as selected_real_kind.F90 and selected_int_kind.F90 * Makefile.in: Regenerate. * generated/_sqrt_c8.F90: Regenerate. * generated/_sign_r16.F90: Regenerate. * generated/_log_c16.F90: Regenerate. * generated/_sin_c10.F90: Regenerate. * generated/_tanh_r4.F90: Regenerate. * generated/_tanh_r8.F90: Regenerate. * generated/_log10_r10.F90: Regenerate. * generated/_aimag_c4.F90: Regenerate. * generated/_sign_r4.F90: Regenerate. * generated/_aimag_c8.F90: Regenerate. * generated/_sign_r8.F90: Regenerate. * generated/_mod_i4.F90: Regenerate. * generated/_cos_r16.F90: Regenerate. * generated/_aint_r10.F90: Regenerate. * generated/_mod_i8.F90: Regenerate. * generated/_abs_i16.F90: Regenerate. * generated/_sqrt_c10.F90: Regenerate. * generated/_atan2_r4.F90: Regenerate. * generated/_cos_c4.F90: Regenerate. * generated/_atan_r16.F90: Regenerate. * generated/_tanh_r10.F90: Regenerate. * generated/_atan2_r8.F90: Regenerate. * generated/_cos_c8.F90: Regenerate. * generated/_exp_r4.F90: Regenerate. * generated/_log_r10.F90: Regenerate. * generated/_exp_r8.F90: Regenerate. * generated/_abs_r4.F90: Regenerate. * generated/_abs_r8.F90: Regenerate. * generated/_sin_r16.F90: Regenerate. * generated/_tan_r4.F90: Regenerate. * generated/_tan_r8.F90: Regenerate. * generated/_sign_i4.F90: Regenerate. * generated/_sign_i8.F90: Regenerate. * generated/_exp_c16.F90: Regenerate. * generated/_sqrt_r16.F90: Regenerate. * generated/_conjg_c4.F90: Regenerate. * generated/_conjg_c8.F90: Regenerate. * generated/_dim_r16.F90: Regenerate. * generated/_mod_r10.F90: Regenerate. * generated/_abs_c10.F90: Regenerate. * generated/_conjg_c16.F90: Regenerate. * generated/_tan_r16.F90: Regenerate. * generated/_asinh_r10.F90: Regenerate. * generated/_abs_i4.F90: Regenerate. * generated/_abs_i8.F90: Regenerate. * generated/_acos_r10.F90: Regenerate. * generated/_exp_r10.F90: Regenerate. * generated/_acosh_r16.F90: Regenerate. * generated/_atan2_r16.F90: Regenerate. * generated/_cos_c16.F90: Regenerate. * generated/_mod_i16.F90: Regenerate. * generated/_asin_r4.F90: Regenerate. * generated/_anint_r16.F90: Regenerate. * generated/_asin_r8.F90: Regenerate. * generated/_aimag_c10.F90: Regenerate. * generated/_exp_c4.F90: Regenerate. * generated/_sinh_r10.F90: Regenerate. * generated/_exp_c8.F90: Regenerate. * generated/_log10_r4.F90: Regenerate. * generated/_log10_r8.F90: Regenerate. * generated/_abs_c4.F90: Regenerate. * generated/_abs_r16.F90: Regenerate. * generated/_abs_c8.F90: Regenerate. * generated/_asin_r10.F90: Regenerate. * generated/_sign_r10.F90: Regenerate. * generated/_atanh_r16.F90: Regenerate. * generated/_log_c10.F90: Regenerate. * generated/_cosh_r16.F90: Regenerate. * generated/_sin_c16.F90: Regenerate. * generated/_cos_r10.F90: Regenerate. * generated/_log10_r16.F90: Regenerate. * generated/_aint_r16.F90: Regenerate. * generated/_acos_r4.F90: Regenerate. * generated/_acos_r8.F90: Regenerate. * generated/_sqrt_c16.F90: Regenerate. * generated/_acosh_r4.F90: Regenerate. * generated/_atan_r10.F90: Regenerate. * generated/_acosh_r8.F90: Regenerate. * generated/_sign_i16.F90: Regenerate. * generated/_tanh_r16.F90: Regenerate. * generated/_log_r4.F90: Regenerate. * generated/_log_r8.F90: Regenerate. * generated/_sin_r4.F90: Regenerate. * generated/_sin_r8.F90: Regenerate. * generated/_log_r16.F90: Regenerate. * generated/_sin_r10.F90: Regenerate. * generated/_sqrt_r4.F90: Regenerate. * generated/_exp_c10.F90: Regenerate. * generated/_sqrt_r8.F90: Regenerate. * generated/_asinh_r4.F90: Regenerate. * generated/_sqrt_r10.F90: Regenerate. * generated/_asinh_r8.F90: Regenerate. * generated/_dim_r4.F90: Regenerate. * generated/_dim_r8.F90: Regenerate. * generated/_dim_r10.F90: Regenerate. * generated/_cosh_r4.F90: Regenerate. * generated/_conjg_c10.F90: Regenerate. * generated/_tan_r10.F90: Regenerate. * generated/_cosh_r8.F90: Regenerate. * generated/_mod_r16.F90: Regenerate. * generated/_abs_c16.F90: Regenerate. * generated/_cos_r4.F90: Regenerate. * generated/_asinh_r16.F90: Regenerate. * generated/_cos_r8.F90: Regenerate. * generated/_atanh_r4.F90: Regenerate. * generated/_atanh_r8.F90: Regenerate. * generated/_acos_r16.F90: Regenerate. * generated/_anint_r4.F90: Regenerate. * generated/_acosh_r10.F90: Regenerate. * generated/_anint_r8.F90: Regenerate. * generated/_exp_r16.F90: Regenerate. * generated/_mod_r4.F90: Regenerate. * generated/_cos_c10.F90: Regenerate. * generated/_atan2_r10.F90: Regenerate. * generated/_dim_i16.F90: Regenerate. * generated/_mod_r8.F90: Regenerate. * generated/_anint_r10.F90: Regenerate. * generated/_aint_r4.F90: Regenerate. * generated/_aint_r8.F90: Regenerate. * generated/_dim_i4.F90: Regenerate. * generated/_sinh_r4.F90: Regenerate. * generated/_log_c4.F90: Regenerate. * generated/_dim_i8.F90: Regenerate. * generated/_sinh_r8.F90: Regenerate. * generated/_log_c8.F90: Regenerate. * generated/_sin_c4.F90: Regenerate. * generated/_sin_c8.F90: Regenerate. * generated/misc_specifics.F90: Regenerate. * generated/_abs_r10.F90: Regenerate. * generated/_aimag_c16.F90: Regenerate. * generated/_atan_r4.F90: Regenerate. * generated/_sinh_r16.F90: Regenerate. * generated/_atan_r8.F90: Regenerate. * generated/_atanh_r10.F90: Regenerate. * generated/_cosh_r10.F90: Regenerate. * generated/_sqrt_c4.F90: Regenerate. * generated/_asin_r16.F90: Regenerate. From-SVN: r121007
203 lines
5.0 KiB
Fortran
203 lines
5.0 KiB
Fortran
! Copyright 2002, 2005 Free Software Foundation, Inc.
|
|
! Contributed by Tobias Schl"uter
|
|
!
|
|
!This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
|
!
|
|
!GNU libgfortran is free software; you can redistribute it and/or
|
|
!modify it under the terms of the GNU General Public
|
|
!License as published by the Free Software Foundation; either
|
|
!version 2 of the License, or (at your option) any later version.
|
|
|
|
!In addition to the permissions in the GNU General Public License, the
|
|
!Free Software Foundation gives you unlimited permission to link the
|
|
!compiled version of this file into combinations with other programs,
|
|
!and to distribute those combinations without any restriction coming
|
|
!from the use of this file. (The General Public License restrictions
|
|
!do apply in other respects; for example, they cover modification of
|
|
!the file, and distribution when not linked into a combine
|
|
!executable.)
|
|
!
|
|
!GNU libgfortran is distributed in the hope that it will be useful,
|
|
!but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
!GNU General Public License for more details.
|
|
!
|
|
!You should have received a copy of the GNU General Public
|
|
!License along with libgfortran; see the file COPYING. If not,
|
|
!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
!Boston, MA 02110-1301, USA.
|
|
!
|
|
! Specifics for the intrinsics whose calling conventions change if
|
|
! -ff2c is used.
|
|
!
|
|
! There are two annoyances WRT the preprocessor:
|
|
! - we're using -traditional-cpp, so we can't use the ## operator.
|
|
! - macros expand to a single line, and Fortran lines can't be wider
|
|
! than 132 characters, therefore we use two macros to split the lines
|
|
!
|
|
! The cases we need to implement are functions returning default REAL
|
|
! or COMPLEX. The former need to return DOUBLE PRECISION instead of REAL,
|
|
! the latter become subroutines returning via a hidden first argument.
|
|
|
|
! one argument functions
|
|
#define REAL_HEAD(NAME) \
|
|
elemental function _gfortran_f2c_specific__/**/NAME/**/_r4 (parm) result(res);
|
|
|
|
#define REAL_BODY(NAME) \
|
|
REAL, intent (in) :: parm; \
|
|
DOUBLE PRECISION :: res; \
|
|
res = NAME (parm); \
|
|
end function
|
|
|
|
#define COMPLEX_HEAD(NAME) \
|
|
subroutine _gfortran_f2c_specific__/**/NAME/**/_c4 (res, parm);
|
|
|
|
#define COMPLEX_BODY(NAME) \
|
|
COMPLEX, intent (in) :: parm; \
|
|
COMPLEX, intent (out) :: res; \
|
|
res = NAME (parm); \
|
|
end subroutine
|
|
|
|
#define DCOMPLEX_HEAD(NAME) \
|
|
subroutine _gfortran_f2c_specific__/**/NAME/**/_c8 (res, parm);
|
|
|
|
#define DCOMPLEX_BODY(NAME) \
|
|
DOUBLE COMPLEX, intent (in) :: parm; \
|
|
DOUBLE COMPLEX, intent (out) :: res; \
|
|
res = NAME (parm); \
|
|
end subroutine
|
|
|
|
REAL_HEAD(abs)
|
|
REAL_BODY(abs)
|
|
|
|
! abs is special in that the result is real
|
|
elemental function _gfortran_f2c_specific__abs_c4 (parm) result (res)
|
|
COMPLEX, intent(in) :: parm
|
|
DOUBLE PRECISION :: res
|
|
res = abs(parm)
|
|
end function
|
|
|
|
|
|
! aimag is special in that the result is real
|
|
elemental function _gfortran_f2c_specific__aimag_c4 (parm)
|
|
complex(kind=4), intent(in) :: parm
|
|
double precision :: _gfortran_f2c_specific__aimag_c4
|
|
_gfortran_f2c_specific__aimag_c4 = aimag(parm)
|
|
end function
|
|
|
|
elemental function _gfortran_f2c_specific__aimag_c8 (parm)
|
|
complex(kind=8), intent(in) :: parm
|
|
double precision :: _gfortran_f2c_specific__aimag_c8
|
|
_gfortran_f2c_specific__aimag_c8 = aimag(parm)
|
|
end function
|
|
|
|
|
|
REAL_HEAD(exp)
|
|
REAL_BODY(exp)
|
|
COMPLEX_HEAD(exp)
|
|
COMPLEX_BODY(exp)
|
|
DCOMPLEX_HEAD(exp)
|
|
DCOMPLEX_BODY(exp)
|
|
|
|
REAL_HEAD(log)
|
|
REAL_BODY(log)
|
|
COMPLEX_HEAD(log)
|
|
COMPLEX_BODY(log)
|
|
DCOMPLEX_HEAD(log)
|
|
DCOMPLEX_BODY(log)
|
|
|
|
REAL_HEAD(log10)
|
|
REAL_BODY(log10)
|
|
|
|
REAL_HEAD(sqrt)
|
|
REAL_BODY(sqrt)
|
|
COMPLEX_HEAD(sqrt)
|
|
COMPLEX_BODY(sqrt)
|
|
DCOMPLEX_HEAD(sqrt)
|
|
DCOMPLEX_BODY(sqrt)
|
|
|
|
REAL_HEAD(asin)
|
|
REAL_BODY(asin)
|
|
|
|
REAL_HEAD(acos)
|
|
REAL_BODY(acos)
|
|
|
|
REAL_HEAD(atan)
|
|
REAL_BODY(atan)
|
|
|
|
REAL_HEAD(asinh)
|
|
REAL_BODY(asinh)
|
|
|
|
REAL_HEAD(acosh)
|
|
REAL_BODY(acosh)
|
|
|
|
REAL_HEAD(atanh)
|
|
REAL_BODY(atanh)
|
|
|
|
REAL_HEAD(sin)
|
|
REAL_BODY(sin)
|
|
COMPLEX_HEAD(sin)
|
|
COMPLEX_BODY(sin)
|
|
DCOMPLEX_HEAD(sin)
|
|
DCOMPLEX_BODY(sin)
|
|
|
|
REAL_HEAD(cos)
|
|
REAL_BODY(cos)
|
|
COMPLEX_HEAD(cos)
|
|
COMPLEX_BODY(cos)
|
|
DCOMPLEX_HEAD(cos)
|
|
DCOMPLEX_BODY(cos)
|
|
|
|
REAL_HEAD(tan)
|
|
REAL_BODY(tan)
|
|
|
|
REAL_HEAD(sinh)
|
|
REAL_BODY(sinh)
|
|
|
|
REAL_HEAD(cosh)
|
|
REAL_BODY(cosh)
|
|
|
|
REAL_HEAD(tanh)
|
|
REAL_BODY(tanh)
|
|
|
|
REAL_HEAD(aint)
|
|
REAL_BODY(aint)
|
|
|
|
REAL_HEAD(anint)
|
|
REAL_BODY(anint)
|
|
|
|
! two argument functions
|
|
#define REAL2_HEAD(NAME) \
|
|
elemental function _gfortran_f2c_specific__/**/NAME/**/_r4 (p1, p2) result(res);
|
|
|
|
#define REAL2_BODY(NAME) \
|
|
REAL, intent (in) :: p1, p2; \
|
|
DOUBLE PRECISION :: res; \
|
|
res = NAME (p1, p2); \
|
|
end function
|
|
|
|
REAL2_HEAD(sign)
|
|
REAL2_BODY(sign)
|
|
|
|
REAL2_HEAD(dim)
|
|
REAL2_BODY(dim)
|
|
|
|
REAL2_HEAD(atan2)
|
|
REAL2_BODY(atan2)
|
|
|
|
REAL2_HEAD(mod)
|
|
REAL2_BODY(mod)
|
|
|
|
! conjg is special-cased because it is not suffixed _c4 but _4
|
|
subroutine _gfortran_f2c_specific__conjg_4 (res, parm)
|
|
COMPLEX, intent (in) :: parm
|
|
COMPLEX, intent (out) :: res
|
|
res = conjg (parm)
|
|
end subroutine
|
|
subroutine _gfortran_f2c_specific__conjg_8 (res, parm)
|
|
DOUBLE COMPLEX, intent (in) :: parm
|
|
DOUBLE COMPLEX, intent (out) :: res
|
|
res = conjg (parm)
|
|
end subroutine
|
|
|