summaryrefslogtreecommitdiff
path: root/src/benoit/helpscrn.cc
blob: 140f5efab250567fc9d5942f3875a9992177547c (plain) (blame)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# include <benoit/archstr.hh>
# include <benoit/helpscrn.hh>
# include <benoit/d/arch.hh>
# include <benoit/d/kernel.hh>
# include <benoit/d/ver.hh>
# include <benoit/exit.hh>
# include <benoit/kernelstr.hh>
# include <benoit/logfunc.hh>
# include <benoit/print.hh>
# include <fmt/core.h>
# include <string>
# include <unordered_map>
using namespace std::literals::string_literals;
[[noreturn]] void benoit::helpscrn() noexcept {
	std::string const funcname = "benoit::helpscrn()"s;
	benoit::logfunc(funcname);
	std::string cmdate = ""s;
	{
		std::string date = __DATE__;
		std::string time = __TIME__;
		std::unordered_map<std::string,std::string> monthmap = {
			{
				"Jan",
				"01",
			},
			{
				"Feb",
				"02",
			},
			{
				"Mar",
				"03",
			},
			{
				"Apr",
				"04",
			},
			{
				"May",
				"05",
			},
			{
				"Jun",
				"06",
			},
			{
				"Jul",
				"07",
			},
			{
				"Aug",
				"08",
			},
			{
				"Sep",
				"09",
			},
			{
				"Oct",
				"10",
			},
			{
				"Nov",
				"11",
			},
			{
				"Dec",
				"12",
			},
		};
		std::string year  = date.substr(0x7);
		std::string month = monthmap[date.substr(0x0,0x3)];
		std::string day   = date.substr(0x4,0x2);
		cmdate            = year + "-"s + month + "-"s + day + "T"s + time;
	}
	std::string cppver = ""s;
	{
		long constexpr cplusplus = __cplusplus;
		switch(cplusplus) {
			default:
				cppver = fmt::format("{}"s,cplusplus);
				break;
			case 0x30C1Fl:
				cppver = "C++98 / C++03"s;
				break;
			case 0x3118Fl:
				cppver = "C++11"s;
				break;
			case 0x312BAl:
				cppver = "C++14"s;
				break;
			case 0x313E7l:
				cppver = "C++17"s;
				break;
			case 0x31512l:
				cppver = "C++20"s;
				break;
		}
	}
	std::string datmod = fmt::format("{}/{}/{}/{}/{}",sizeof(short),sizeof(int),sizeof(long),sizeof(long long),sizeof(void *));
	if constexpr((sizeof(short) == 0x2) && (sizeof(int) == 0x4) && (sizeof(long) == 0x4) && (sizeof(long long) == 0x8) && (sizeof(void *) == 0x8)) {
		datmod = fmt::format("LLP64 (noob / {})"s,datmod);
	}
	else if constexpr((sizeof(short) == 0x2) && (sizeof(int) == 0x4) && (sizeof(long) == 0x8) && (sizeof(long long) == 0x8) && (sizeof(void *) == 0x8)) {
		datmod = fmt::format("LP64 ({})"s,datmod);
	}
	else if constexpr((sizeof(short) == 0x2) && (sizeof(int) == 0x8) && (sizeof(long) == 0x8) && (sizeof(long long) == 0x8) && (sizeof(void *) == 0x8)) {
		datmod = fmt::format("ILP64 ({})"s,datmod);
	}
	else if constexpr((sizeof(short) == 0x8) && (sizeof(int) == 0x8) && (sizeof(long) == 0x8) && (sizeof(long long) == 0x8) && (sizeof(void *) == 0x8)) {
		datmod = fmt::format("SILP64 (wtf? / {})"s,datmod);
	}
	else {
		datmod = fmt::format("{} AKA how the fuck did this get compiled?"s,datmod);
	}
	benoit::print(""s);
	benoit::print(fmt::format("benoit {}",benoit::d::ver));
	benoit::print("Copyright 2021 Gabriel Jensen"s);
	benoit::print(""s);
	benoit::print("Arguments:"s);
	benoit::print("\u0009force-backtrace={false,true}:"s);
	benoit::print("\u0009\u0009Forces the backtrace of the at programme exit."s);
	benoit::print("\u0009height={0..65536}:"s);
	benoit::print("\u0009\u0009Sets the height for the rendered image."s);
	benoit::print("\u0009help, --help:"s);
	benoit::print("\u0009\u0009Displays this information screen."s);
	benoit::print("\u0009threads={0..65536}:"s);
	benoit::print("\u0009\u0009Sets the number of threads that will be used."s);
	benoit::print("\u0009height={0..65536}:"s);
	benoit::print("\u0009\u0009Sets the width for the rendered image."s);
	benoit::print(""s);
	benoit::print("Compilation Information:"s);
	benoit::print(fmt::format("\u0009Architecture:          {}"s,benoit::archstr(benoit::d::arch)));
	benoit::print(fmt::format("\u0009Compilation Date:      {}"s,cmdate));
	benoit::print(fmt::format("\u0009Compiler C++ Standard: {}"s,cppver));
	benoit::print(fmt::format("\u0009Data Model:            {}"s,datmod));
	benoit::print(fmt::format("\u0009System Kernel:         {}"s,benoit::kernelstr(benoit::d::kernel)));
	benoit::print(""s);
	benoit::exit(EXIT_SUCCESS);
}