1 //===-- include/flang/Runtime/command.h -------------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef FORTRAN_RUNTIME_COMMAND_H_ 10 #define FORTRAN_RUNTIME_COMMAND_H_ 11 12 #include "flang/Runtime/entry-names.h" 13 14 #include <cstdint> 15 16 namespace Fortran::runtime { 17 class Descriptor; 18 19 extern "C" { 20 // 16.9.51 COMMAND_ARGUMENT_COUNT 21 // 22 // Lowering may need to cast the result to match the precision of the default 23 // integer kind. 24 std::int32_t RTNAME(ArgumentCount)(); 25 26 // 16.9.82 GET_COMMAND 27 // Try to get the value of the whole command. All of the parameters are 28 // optional. 29 // Return a STATUS as described in the standard. 30 std::int32_t RTNAME(GetCommand)(const Descriptor *command = nullptr, 31 const Descriptor *length = nullptr, const Descriptor *errmsg = nullptr); 32 33 // 16.9.83 GET_COMMAND_ARGUMENT 34 // We're breaking up the interface into several different functions, since most 35 // of the parameters are optional. 36 37 // Try to get the value of the n'th argument. 38 // Returns a STATUS as described in the standard. 39 std::int32_t RTNAME(ArgumentValue)( 40 std::int32_t n, const Descriptor *value, const Descriptor *errmsg); 41 42 // Try to get the significant length of the n'th argument. 43 // Returns 0 if it doesn't manage. 44 std::int64_t RTNAME(ArgumentLength)(std::int32_t n); 45 46 // 16.9.84 GET_ENVIRONMENT_VARIABLE 47 // We're breaking up the interface into several different functions, since most 48 // of the parameters are optional. 49 50 // Try to get the value of the environment variable specified by NAME. 51 // Returns a STATUS as described in the standard. 52 std::int32_t RTNAME(EnvVariableValue)(const Descriptor &name, 53 const Descriptor *value = nullptr, bool trim_name = true, 54 const Descriptor *errmsg = nullptr, const char *sourceFile = nullptr, 55 int line = 0); 56 57 // Try to get the significant length of the environment variable specified by 58 // NAME. Returns 0 if it doesn't manage. 59 std::int64_t RTNAME(EnvVariableLength)(const Descriptor &name, 60 bool trim_name = true, const char *sourceFile = nullptr, int line = 0); 61 } 62 } // namespace Fortran::runtime 63 64 #endif // FORTRAN_RUNTIME_COMMAND_H_ 65