Warning: This file is not a C or C++ file. It does not have highlighting.

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#include <cstdint>
14
15#ifdef _WIN32
16// On Windows* OS GetCurrentProcessId returns DWORD aka uint32_t
17typedef std::uint32_t pid_t;
18#else
19#include "sys/types.h" //pid_t
20#endif
21
22namespace Fortran::runtime {
23class Descriptor;
24
25extern "C" {
26// 16.9.51 COMMAND_ARGUMENT_COUNT
27//
28// Lowering may need to cast the result to match the precision of the default
29// integer kind.
30std::int32_t RTNAME(ArgumentCount)();
31
32// Calls getpid()
33pid_t RTNAME(GetPID)();
34
35// 16.9.82 GET_COMMAND
36// Try to get the value of the whole command. All of the parameters are
37// optional.
38// Return a STATUS as described in the standard.
39std::int32_t RTNAME(GetCommand)(const Descriptor *command = nullptr,
40 const Descriptor *length = nullptr, const Descriptor *errmsg = nullptr,
41 const char *sourceFile = nullptr, int line = 0);
42
43// 16.9.83 GET_COMMAND_ARGUMENT
44// Try to get the value of the n'th argument.
45// Returns a STATUS as described in the standard.
46std::int32_t RTNAME(GetCommandArgument)(std::int32_t n,
47 const Descriptor *argument = nullptr, const Descriptor *length = nullptr,
48 const Descriptor *errmsg = nullptr, const char *sourceFile = nullptr,
49 int line = 0);
50
51// 16.9.84 GET_ENVIRONMENT_VARIABLE
52// Try to get the value of the environment variable specified by NAME.
53// Returns a STATUS as described in the standard.
54std::int32_t RTNAME(GetEnvVariable)(const Descriptor &name,
55 const Descriptor *value = nullptr, const Descriptor *length = nullptr,
56 bool trim_name = true, const Descriptor *errmsg = nullptr,
57 const char *sourceFile = nullptr, int line = 0);
58}
59} // namespace Fortran::runtime
60
61#endif // FORTRAN_RUNTIME_COMMAND_H_
62

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of flang/include/flang/Runtime/command.h