2020-01-24 08:59:27 +08:00
|
|
|
//===-- runtime/environment.h -----------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef FORTRAN_RUNTIME_ENVIRONMENT_H_
|
|
|
|
#define FORTRAN_RUNTIME_ENVIRONMENT_H_
|
|
|
|
|
2020-02-25 23:11:52 +08:00
|
|
|
#include "flang/Decimal/decimal.h"
|
2020-07-22 08:37:35 +08:00
|
|
|
#include <optional>
|
2020-01-24 08:59:27 +08:00
|
|
|
|
|
|
|
namespace Fortran::runtime {
|
2020-07-22 08:37:35 +08:00
|
|
|
|
|
|
|
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
|
|
constexpr bool isHostLittleEndian{false};
|
|
|
|
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
|
|
constexpr bool isHostLittleEndian{true};
|
|
|
|
#else
|
|
|
|
#error host endianness is not known
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// External unformatted I/O data conversions
|
|
|
|
enum class Convert { Unknown, Native, LittleEndian, BigEndian, Swap };
|
|
|
|
|
|
|
|
std::optional<Convert> GetConvertFromString(const char *, std::size_t);
|
|
|
|
|
2020-01-24 08:59:27 +08:00
|
|
|
struct ExecutionEnvironment {
|
|
|
|
void Configure(int argc, const char *argv[], const char *envp[]);
|
|
|
|
|
|
|
|
int argc;
|
|
|
|
const char **argv;
|
|
|
|
const char **envp;
|
|
|
|
int listDirectedOutputLineLengthLimit;
|
2020-02-05 08:55:45 +08:00
|
|
|
enum decimal::FortranRounding defaultOutputRoundingMode;
|
2020-07-22 08:37:35 +08:00
|
|
|
Convert conversion;
|
2020-01-24 08:59:27 +08:00
|
|
|
};
|
|
|
|
extern ExecutionEnvironment executionEnvironment;
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::runtime
|
2020-02-05 08:55:45 +08:00
|
|
|
|
2020-03-29 12:00:16 +08:00
|
|
|
#endif // FORTRAN_RUNTIME_ENVIRONMENT_H_
|