-
Notifications
You must be signed in to change notification settings - Fork 3
/
Main.cpp
98 lines (79 loc) · 2.79 KB
/
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// =====================================================================================
//
// Filename: Main.cpp
//
// Description: Driver program for application
//
// Version: 1.0
// Created: 02/28/2014 03:04:02 PM
// Revision: none
// Compiler: g++
//
// Author: David P. Riedel (dpr), driedel@cox.net
// License: GNU General Public License v3
// Company:
//
// =====================================================================================
/* This file is part of PF_CollectData. */
/* PF_CollectData is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* PF_CollectData is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* You should have received a copy of the GNU General Public License */
/* along with PF_CollectData. If not, see <http://www.gnu.org/licenses/>. */
#include <exception>
#include <iostream>
// #include <pybind11/embed.h> // everything needed for embedding
// namespace py = pybind11;
// using namespace py::literals;
#include <decimal.hh>
using decimal::Decimal;
#include "PF_CollectDataApp.h"
int main(int argc, char** argv)
{
int result = 0;
try
{
decimal::context_template = decimal::IEEEContext(decimal::DECIMAL64);
decimal::context_template.round(decimal::ROUND_HALF_UP);
decimal::context = decimal::context_template;
// help to optimize c++ stream I/O (may screw up threaded I/O though)
std::ios_base::sync_with_stdio(false);
// py::scoped_interpreter guard{false}; // start the interpreter and keep it alive
//
// py::exec(R"(
// import PF_DrawChart
// )"
// );
PF_CollectDataApp myApp(argc, argv);
bool startup_ok = myApp.Startup();
if (startup_ok)
{
myApp.Run();
myApp.Shutdown();
}
}
catch (std::system_error& e)
{
// any system problems, we eventually abort, but only after finishing work in process.
auto ec = e.code();
std::cerr << "Category: " << ec.category().name() << ". Value: " << ec.value() <<
". Message: " << ec.message() << '\n';
result = 3;
}
catch (std::exception& e)
{
std::cout << "Problem collecting files: " << e.what() << '\n';
result = 4;
}
catch (...)
{
std::cout << "Unknown problem collecting files." << '\n';
result = 5;
}
return result;
}