comparison flang/runtime/environment.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents
children 2e18cbf3894f
comparison
equal deleted inserted replaced
172:9fbae9c8bf63 173:0572611fdcc8
1 //===-- runtime/environment.cpp ---------------------------------*- 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 #include "environment.h"
10 #include <cstdio>
11 #include <cstdlib>
12 #include <limits>
13
14 namespace Fortran::runtime {
15 ExecutionEnvironment executionEnvironment;
16
17 void ExecutionEnvironment::Configure(
18 int ac, const char *av[], const char *env[]) {
19 argc = ac;
20 argv = av;
21 envp = env;
22 listDirectedOutputLineLengthLimit = 79; // PGI default
23 defaultOutputRoundingMode =
24 decimal::FortranRounding::RoundNearest; // RP(==RN)
25
26 if (auto *x{std::getenv("FORT_FMT_RECL")}) {
27 char *end;
28 auto n{std::strtol(x, &end, 10)};
29 if (n > 0 && n < std::numeric_limits<int>::max() && *end == '\0') {
30 listDirectedOutputLineLengthLimit = n;
31 } else {
32 std::fprintf(
33 stderr, "Fortran runtime: FORT_FMT_RECL=%s is invalid; ignored\n", x);
34 }
35 }
36
37 // TODO: Set RP/ROUND='PROCESSOR_DEFINED' from environment
38 }
39 } // namespace Fortran::runtime