1 //===-- runtime/extensions.cpp --------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // These C-coded entry points with Fortran-mangled names implement legacy
10 // extensions that will eventually be implemented in Fortran.
12 #include "flang/Runtime/extensions.h"
13 #include "flang/Runtime/command.h"
14 #include "flang/Runtime/descriptor.h"
15 #include "flang/Runtime/io-api.h"
19 namespace Fortran::runtime
{
21 // SUBROUTINE FLUSH(N)
24 void FORTRAN_PROCEDURE_NAME(flush
)(const int &unit
) {
25 Cookie cookie
{IONAME(BeginFlush
)(unit
, __FILE__
, __LINE__
)};
26 IONAME(EndIoStatement
)(cookie
);
31 std::int32_t FORTRAN_PROCEDURE_NAME(iargc
)() { return RTNAME(ArgumentCount
)(); }
33 // CALL GETARG(N, ARG)
34 void FORTRAN_PROCEDURE_NAME(getarg
)(
35 std::int32_t &n
, std::int8_t *arg
, std::int64_t length
) {
36 Descriptor value
{*Descriptor::Create(1, length
, arg
, 0)};
37 (void)RTNAME(GetCommandArgument
)(
38 n
, &value
, nullptr, nullptr, __FILE__
, __LINE__
);
40 } // namespace Fortran::runtime