summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/benoit/archstr.cc36
-rw-r--r--src/benoit/arghandl.cc133
-rw-r--r--src/benoit/crtcfg.cc40
-rw-r--r--src/benoit/d/alpha.cc2
-rw-r--r--src/benoit/d/cfg.cc4
-rw-r--r--src/benoit/d/dobt.cc2
-rw-r--r--src/benoit/d/imgfmt.cc3
-rw-r--r--src/benoit/d/logdoprint.cc7
-rw-r--r--src/benoit/d/maxiter.cc2
-rw-r--r--src/benoit/d/numthrds.cc2
-rw-r--r--src/benoit/d/outimg.cc4
-rw-r--r--src/benoit/d/pos.cc3
-rw-r--r--src/benoit/d/printdolog.cc2
-rw-r--r--src/benoit/d/resx.cc2
-rw-r--r--src/benoit/d/resy.cc2
-rw-r--r--src/benoit/d/thelog.cc4
-rw-r--r--src/benoit/err/clsfil.cc8
-rw-r--r--src/benoit/err/wrttofil.cc8
-rw-r--r--src/benoit/exit.cc43
-rw-r--r--src/benoit/helpscrn.cc152
-rw-r--r--src/benoit/kernelstr.cc52
-rw-r--r--src/benoit/loadcfg.cc48
-rw-r--r--src/benoit/log.cc21
-rw-r--r--src/benoit/logfunc.cc9
-rw-r--r--src/benoit/logfuncret.cc9
-rw-r--r--src/benoit/main.cc30
-rw-r--r--src/benoit/plotmandelbrot.cc137
-rw-r--r--src/benoit/print.cc23
-rw-r--r--src/benoit/t/pos/pos.cc5
-rw-r--r--src/benoit/wrtimg.cc95
-rw-r--r--src/main.cc4
31 files changed, 0 insertions, 892 deletions
diff --git a/src/benoit/archstr.cc b/src/benoit/archstr.cc
deleted file mode 100644
index 2feab4c..0000000
--- a/src/benoit/archstr.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-# include <benoit/archstr.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/t/arch.hh>
-# include <string>
-# include <unordered_map>
-using namespace std::literals::string_literals;
-std::string benoit::archstr(benoit::t::arch arch) noexcept {
- std::string const funcname = "benoit::archstr(benoit::t::arch)"s;
- benoit::logfunc(funcname);
- std::unordered_map<benoit::t::arch,std::string> map = {
- {
- benoit::t::arch::aarch64,
- "ARM64 / AArch64"s,
- },
- {
- benoit::t::arch::amd64,
- "AMD64 / x86-64"s,
- },
- {
- benoit::t::arch::ia64,
- "IA-64"s,
- },
- {
- benoit::t::arch::ppc64,
- "PPC64"s,
- },
- {
- benoit::t::arch::unknown,
- "N/A"s,
- }
- };
- std::string str = map[arch];
- benoit::logfuncret(funcname);
- return str;
-}
diff --git a/src/benoit/arghandl.cc b/src/benoit/arghandl.cc
deleted file mode 100644
index d54cde8..0000000
--- a/src/benoit/arghandl.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-# include <benoit/archstr.hh>
-# include <benoit/arghandl.hh>
-# include <benoit/d/alpha.hh>
-# include <benoit/d/dobt.hh>
-# include <benoit/d/imgfmt.hh>
-# include <benoit/d/maxiter.hh>
-# include <benoit/d/numthrds.hh>
-# include <benoit/d/outimg.hh>
-# include <benoit/d/resx.hh>
-# include <benoit/d/resy.hh>
-# include <benoit/exit.hh>
-# include <benoit/helpscrn.hh>
-# include <benoit/kernelstr.hh>
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/print.hh>
-# include <benoit/t/imgfmt.hh>
-# include <charconv>
-# include <fmt/core.h>
-# include <string>
-# include <unordered_map>
-using namespace std::literals::string_literals;
-void benoit::arghandl(int const & argc,char const * * & argv) {
- std::string const funcname = "benoit::arghandl(int const &,char const * * &)"s;
- benoit::logfunc(funcname);
- if(argc > 0x1) {
- benoit::log(fmt::format("{} argument(s) have been detected."s,(argc - 0x1)));
- for(int pos = 0x1;(pos < argc);++pos) {
- std::string arg = argv[pos];
- benoit::log(fmt::format("Found argument “{}”.",arg));
- std::string::size_type eqpos = arg.find("="s);
- if(eqpos != std::string::npos) {
- std::unordered_map<std::string,bool> strtobool = {
- {
- "false"s,
- false,
- },
- {
- "true"s,
- true,
- }
- };
- std::string invalvalforobj = "Unrecognised value “{}” for object “{}”."s;
- std::string obj = arg.substr(0x0,eqpos);
- benoit::log(funcname,fmt::format("Found object “{}”.",obj));
- std::string val = arg.substr(eqpos + 0x1);
- benoit::log(funcname,fmt::format("Found value “{}”.",val));
- if(obj == "alpha"s) {
- if(!strtobool.contains(val)) {
- benoit::print(fmt::format(invalvalforobj,val,obj));
- }
- else {
- benoit::d::alpha = strtobool[val];
- }
- }
- else if(obj == "force-backtrace"s) {
- if(!strtobool.contains(val)) {
- benoit::print(fmt::format(invalvalforobj,val,obj));
- }
- else {
- benoit::d::dobt = strtobool[val];
- }
- }
- else if(obj == "format"s) {
- if(val == "PNG"s) {
- benoit::d::imgfmt = benoit::t::imgfmt::png;
- }
- else if(val == "WebP"s) {
- benoit::d::imgfmt = benoit::t::imgfmt::webp;
- }
- else {
- benoit::print(fmt::format(invalvalforobj,val,obj),true);
- }
- }
- else if(obj == "height"s) {
- std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resy);
- if(benoit::d::resy > 0x10000) {
- benoit::print(fmt::format("Argument “{}” sets the height to {}, but the maximum width is 65536.",arg,benoit::d::resy),true);
- benoit::d::resy = 0x10000;
- }
- }
- else if(obj == "maximum-iterations"s) {
- std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::maxiter);
- }
- else if(obj == "output"s) {
- benoit::d::outimg = val;
- }
- else if(obj == "threads"s) {
- std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::numthrds);
- if(benoit::d::numthrds > 0x10000) {
- benoit::print(fmt::format("Argument “{}” sets the number of threads to {}, but the maximum number of threads is 65536."s,arg,benoit::d::numthrds),true);
- benoit::d::numthrds = 0x10000;
- }
- }
- else if(obj == "width"s) {
- std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resx);
- if(benoit::d::resx > 0x10000) {
- benoit::print(fmt::format("Argument “{}” sets the width to {}, but the maximum width is 65536."s,arg,benoit::d::resx),true);
- benoit::d::resx = 0x10000;
- }
- }
- else {
- benoit::print(fmt::format("Invalid object “{}”."s,obj),true);
- }
- }
- else {
- if((arg == "help"s) || (arg == "--help"s)) {
- benoit::helpscrn();
- }
- else {
- benoit::print(fmt::format("Invalid argument “{}”."s,arg),true);
- }
- }
- }
- }
- else {
- benoit::log("No arguments have been detected."s);
- }
- switch(benoit::d::imgfmt) {
- case benoit::t::imgfmt::png:
- benoit::d::outimg.append(".png"s);
- break;
- case benoit::t::imgfmt::webp:
- if((benoit::d::resx > 0x3FFF) || (benoit::d::resy > 0x3FFF)) {
- benoit::exit(EXIT_FAILURE,"WebP does not support a resolution of more than 16383."s);
- }
- benoit::d::outimg.append(".webp"s);
- break;
- }
- benoit::log(funcname,fmt::format("The output image will be \u201C{}\u201D."s,benoit::d::outimg));
- benoit::logfuncret(funcname);
-}
diff --git a/src/benoit/crtcfg.cc b/src/benoit/crtcfg.cc
deleted file mode 100644
index 6784467..0000000
--- a/src/benoit/crtcfg.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-# include <benoit/crtcfg.hh>
-# include <benoit/d/cfg.hh>
-# include <benoit/err/clsfil.hh>
-# include <benoit/err/wrttofil.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/print.hh>
-# include <cstdint>
-# include <fcntl.h>
-# include <fmt/core.h>
-# include <string>
-# include <unistd.h>
-using namespace std::literals::string_literals;
-void benoit::crtcfg() {
- std::string const funcname = "benoit::crtcfg()"s;
- benoit::logfunc(funcname);
- std::string cfgstr = ""s;
- cfgstr.append("{\u000A"s);
- cfgstr.append("\u0009\u0022benoit\u0022:[\u000A"s);
- cfgstr.append("\u0009\u0009{\u000A"s);
- cfgstr.append("\u0009\u0009\u0009\u0022x\u0022:\u00221÷1\u0022,\u000A"s);
- cfgstr.append("\u0009\u0009\u0009\u0022y\u0022:\u00221÷1\u0022,\u000A"s);
- cfgstr.append("\u0009\u0009\u0009\u0022zoom\u0022:\u00220÷1\u0022\u000A"s);
- cfgstr.append("\u0009\u0009}\u000A"s);
- cfgstr.append("\u0009]\u000A"s);
- cfgstr.append("}\u000A"s);
- std::uint8_t * dat = reinterpret_cast<std::uint8_t *>(const_cast<char *>(cfgstr.c_str()));
- int fil = ::open(benoit::d::cfg.c_str(),(O_CREAT | O_TRUNC | O_WRONLY),0x1B4);
- for(unsigned long long pos = 0x0;(pos < cfgstr.size());++pos) {
- ::ssize_t byteswrtn = ::write(fil,&dat[pos],0x1);
- if(byteswrtn < 0x0) {
- benoit::err::wrttofil(benoit::d::cfg);
- return;
- }
- }
- if(::close(fil) < 0x0) {
- benoit::err::clsfil(benoit::d::cfg);
- }
- benoit::logfuncret(funcname);
-}
diff --git a/src/benoit/d/alpha.cc b/src/benoit/d/alpha.cc
deleted file mode 100644
index 65d2dcc..0000000
--- a/src/benoit/d/alpha.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/alpha.hh>
-bool benoit::d::alpha = false;
diff --git a/src/benoit/d/cfg.cc b/src/benoit/d/cfg.cc
deleted file mode 100644
index 0f8e82c..0000000
--- a/src/benoit/d/cfg.cc
+++ /dev/null
@@ -1,4 +0,0 @@
-# include <benoit/d/cfg.hh>
-# include <string>
-using namespace std::literals::string_literals;
-std::string benoit::d::cfg = "benoit.json"s;
diff --git a/src/benoit/d/dobt.cc b/src/benoit/d/dobt.cc
deleted file mode 100644
index 9643b6f..0000000
--- a/src/benoit/d/dobt.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/dobt.hh>
-bool benoit::d::dobt = false;
diff --git a/src/benoit/d/imgfmt.cc b/src/benoit/d/imgfmt.cc
deleted file mode 100644
index 412481a..0000000
--- a/src/benoit/d/imgfmt.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-# include <benoit/d/imgfmt.hh>
-# include <benoit/t/imgfmt.hh>
-benoit::t::imgfmt benoit::d::imgfmt = benoit::t::imgfmt::webp;
diff --git a/src/benoit/d/logdoprint.cc b/src/benoit/d/logdoprint.cc
deleted file mode 100644
index 71de54b..0000000
--- a/src/benoit/d/logdoprint.cc
+++ /dev/null
@@ -1,7 +0,0 @@
-# include <benoit/d/logdoprint.hh>
-bool benoit::d::logdoprint =
-# if defined(NDEBUG)
-false;
-# else
-true;
-# endif
diff --git a/src/benoit/d/maxiter.cc b/src/benoit/d/maxiter.cc
deleted file mode 100644
index 477dd6f..0000000
--- a/src/benoit/d/maxiter.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/maxiter.hh>
-unsigned long long benoit::d::maxiter = 0x100ull;
diff --git a/src/benoit/d/numthrds.cc b/src/benoit/d/numthrds.cc
deleted file mode 100644
index 524ed82..0000000
--- a/src/benoit/d/numthrds.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/numthrds.hh>
-unsigned benoit::d::numthrds = 0x1u;
diff --git a/src/benoit/d/outimg.cc b/src/benoit/d/outimg.cc
deleted file mode 100644
index c6643ef..0000000
--- a/src/benoit/d/outimg.cc
+++ /dev/null
@@ -1,4 +0,0 @@
-# include <benoit/d/outimg.hh>
-# include <string>
-using namespace std::literals::string_literals;
-std::string benoit::d::outimg = "image"s;
diff --git a/src/benoit/d/pos.cc b/src/benoit/d/pos.cc
deleted file mode 100644
index 7930706..0000000
--- a/src/benoit/d/pos.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-# include <benoit/d/pos.hh>
-# include <benoit/t/pos.hh>
-benoit::t::pos benoit::d::pos;
diff --git a/src/benoit/d/printdolog.cc b/src/benoit/d/printdolog.cc
deleted file mode 100644
index 8f4a8ae..0000000
--- a/src/benoit/d/printdolog.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/printdolog.hh>
-bool benoit::d::printdolog = true;
diff --git a/src/benoit/d/resx.cc b/src/benoit/d/resx.cc
deleted file mode 100644
index 9eeec0b..0000000
--- a/src/benoit/d/resx.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/resx.hh>
-unsigned benoit::d::resx = 0x100u;
diff --git a/src/benoit/d/resy.cc b/src/benoit/d/resy.cc
deleted file mode 100644
index ddce771..0000000
--- a/src/benoit/d/resy.cc
+++ /dev/null
@@ -1,2 +0,0 @@
-# include <benoit/d/resy.hh>
-unsigned benoit::d::resy = 0x100u;
diff --git a/src/benoit/d/thelog.cc b/src/benoit/d/thelog.cc
deleted file mode 100644
index b925d3f..0000000
--- a/src/benoit/d/thelog.cc
+++ /dev/null
@@ -1,4 +0,0 @@
-# include <benoit/d/thelog.hh>
-# include <string>
-# include <vector>
-std::vector<std::string> benoit::d::thelog = {};
diff --git a/src/benoit/err/clsfil.cc b/src/benoit/err/clsfil.cc
deleted file mode 100644
index 548ce7a..0000000
--- a/src/benoit/err/clsfil.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-# include <benoit/err/clsfil.hh>
-# include <benoit/print.hh>
-# include <fmt/core.h>
-# include <string>
-using namespace std::literals::string_literals;
-void benoit::err::clsfil(std::string const fil) noexcept {
- benoit::print(fmt::format("Unable to close file “{}”."s,fil),true);
-}
diff --git a/src/benoit/err/wrttofil.cc b/src/benoit/err/wrttofil.cc
deleted file mode 100644
index eb756f9..0000000
--- a/src/benoit/err/wrttofil.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-# include <benoit/err/wrttofil.hh>
-# include <benoit/print.hh>
-# include <fmt/core.h>
-# include <string>
-using namespace std::literals::string_literals;
-void benoit::err::wrttofil(std::string const fil) noexcept {
- benoit::print(fmt::format("Unable to write to “{}”."s,fil),true);
-}
diff --git a/src/benoit/exit.cc b/src/benoit/exit.cc
deleted file mode 100644
index 8d1fb16..0000000
--- a/src/benoit/exit.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-# include <benoit/d/debug.hh>
-# include <benoit/d/dobt.hh>
-# include <benoit/d/printdolog.hh>
-# include <benoit/d/thelog.hh>
-# include <benoit/exit.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/print.hh>
-# include <cstdlib>
-# include <fmt/core.h>
-# include <string>
-# include <unistd.h>
-using namespace std::literals::string_literals;
-[[noreturn]] void benoit::exit(int code,std::string msg) noexcept {
- std::string const funcname = "benoit::exit(int,std::string)"s;
- benoit::logfunc(funcname);
- if(code == EXIT_FAILURE) {
- benoit::print(fmt::format("Exited with code {}: “{}”."s,code,msg),true);
- }
- if(((code == EXIT_FAILURE) && !benoit::d::debug) || benoit::d::dobt) {
- benoit::d::printdolog = false;
- benoit::print(""s);
- benoit::print("+-------------------"s);
- benoit::print("| :Backtrace Begin:"s);
- benoit::print("+-"s);
- benoit::print(""s);
- for(auto entry : benoit::d::thelog) {
- {
- ::timespec sleepfor;
- sleepfor.tv_sec = 0x0;
- sleepfor.tv_nsec = (0x3B9ACA00l / 0x6L);
- ::nanosleep(&sleepfor,nullptr);
- }
- benoit::print(entry);
- }
- benoit::print(""s);
- benoit::print("+-"s);
- benoit::print("| :Backtrace End:"s);
- benoit::print("+-----------------"s);
- benoit::print(""s);
- benoit::d::printdolog = true;
- }
- ::_exit(code);
-}
diff --git a/src/benoit/helpscrn.cc b/src/benoit/helpscrn.cc
deleted file mode 100644
index 02ef215..0000000
--- a/src/benoit/helpscrn.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-# include <benoit/archstr.hh>
-# include <benoit/helpscrn.hh>
-# include <benoit/d/arch.hh>
-# include <benoit/d/kernel.hh>
-# include <benoit/d/logdoprint.hh>
-# include <benoit/d/printdolog.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"s,
- "01"s,
- },
- {
- "Feb"s,
- "02"s,
- },
- {
- "Mar"s,
- "03"s,
- },
- {
- "Apr"s,
- "04"s,
- },
- {
- "May"s,
- "05"s,
- },
- {
- "Jun"s,
- "06"s,
- },
- {
- "Jul"s,
- "07"s,
- },
- {
- "Aug"s,
- "08"s,
- },
- {
- "Sep"s,
- "09"s,
- },
- {
- "Oct"s,
- "10"s,
- },
- {
- "Nov"s,
- "11"s,
- },
- {
- "Dec"s,
- "12"s,
- },
- };
- std::string year = date.substr(0x7);
- std::string month = monthmap[date.substr(0x0,0x3)];
- std::string day = date.substr(0x4,0x2);
- cmdate = fmt::format("{}-{}-{}T{}"s,year,month,day,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);
- }
- bool logdoprint = benoit::d::logdoprint;
- benoit::d::logdoprint = false;
- benoit::d::printdolog = false;
- benoit::print(""s);
- benoit::print(fmt::format("benoit {}",benoit::d::ver));
- benoit::print("Copyright 2021 Gabriel Jensen"s);
- benoit::print("All rigths reserved."s);
- benoit::print(""s);
- benoit::print("Arguments:"s);
- benoit::print("\u0009alpha={false,true}:"s);
- benoit::print("\u0009\u0009Sets whether or not to use alpha or background colour for rendered image."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("\u0009maximum-iterations={0..18446744073709551615}:"s);
- benoit::print("\u0009\u0009Sets the maximum number of iterations allowed."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::d::logdoprint = logdoprint;
- benoit::d::printdolog = true;
- benoit::exit(EXIT_SUCCESS);
-}
diff --git a/src/benoit/kernelstr.cc b/src/benoit/kernelstr.cc
deleted file mode 100644
index 47616f8..0000000
--- a/src/benoit/kernelstr.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-# include <benoit/kernelstr.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/t/kernel.hh>
-# include <string>
-# include <unordered_map>
-using namespace std::literals::string_literals;
-std::string benoit::kernelstr(benoit::t::kernel kernel) noexcept {
- std::string const funcname = "benoit::kernelstr(benoit::t::kernel)"s;
- benoit::logfunc(funcname);
- std::unordered_map<benoit::t::kernel,std::string> map = {
- {
- benoit::t::kernel::darwinos,
- "Darwin OS"s,
- },
- {
- benoit::t::kernel::dragonflybsd,
- "DragonFly BSD"s,
- },
- {
- benoit::t::kernel::freebsd,
- "FreeBSD"s,
- },
- {
- benoit::t::kernel::hurd,
- "Hurd"s,
- },
- {
- benoit::t::kernel::linux,
- "Linux"s,
- },
- {
- benoit::t::kernel::minix,
- "MINIX"s,
- },
- {
- benoit::t::kernel::netbsd,
- "NetBSD"s,
- },
- {
- benoit::t::kernel::openbsd,
- "OpenBSD"s,
- },
- {
- benoit::t::kernel::unknown,
- "N/A"s,
- }
- };
- std::string str = map[kernel];
- benoit::logfuncret(funcname);
- return str;
-}
diff --git a/src/benoit/loadcfg.cc b/src/benoit/loadcfg.cc
deleted file mode 100644
index b1be003..0000000
--- a/src/benoit/loadcfg.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-# include <benoit/crtcfg.hh>
-# include <benoit/d/cfg.hh>
-# include <benoit/d/pos.hh>
-# include <benoit/loadcfg.hh>
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/print.hh>
-# include <fcntl.h>
-# include <fmt/core.h>
-# include <iostream>
-# include <string>
-# include <sys/stat.h>
-# include <unistd.h>
-# include <iostream>
-using namespace std::literals::string_literals;
-void benoit::loadcfg() {
- std::string const funcname = "benoit::loadcfg()"s;
- benoit::logfunc(funcname);
- if(::access(benoit::d::cfg.c_str(),R_OK) < 0x0) {
- benoit::crtcfg();
- return;
- }
- int filsiz = 0x0;
- {
- struct ::stat st;
- ::stat(benoit::d::cfg.c_str(),&st);
- filsiz = static_cast<int>(st.st_size);
- }
- benoit::log(fmt::format("The size of “{}” is {}."s,benoit::d::cfg,filsiz));
- if(filsiz == 0x0) {
- benoit::crtcfg();
- return;
- }
- std::string cfgstr = ""s;
- {
- int fil = ::open(benoit::d::cfg.c_str(),O_RDONLY);
- char * cfgcstr = ::new char[filsiz];
- for(int pos = 0x0;(pos < filsiz);++pos) {
- if(::read(fil,&cfgcstr[pos],0x1) < 0x0) {
- }
- }
- cfgstr = std::string(cfgcstr);
- delete[] cfgcstr;
- ::close(fil);
- }
- benoit::logfuncret(funcname);
-}
diff --git a/src/benoit/log.cc b/src/benoit/log.cc
deleted file mode 100644
index da7b683..0000000
--- a/src/benoit/log.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-# include <benoit/d/logdoprint.hh>
-# include <benoit/d/printdolog.hh>
-# include <benoit/d/thelog.hh>
-# include <benoit/log.hh>
-# include <benoit/print.hh>
-# include <fmt/core.h>
-# include <string>
-using namespace std::literals::string_literals;
-void benoit::log(std::string msg) {
- std::string const funcname = "benoit::log(std::string)"s;
- if(benoit::d::logdoprint) {
- benoit::d::printdolog = false;
- benoit::print(msg,true);
- benoit::d::printdolog = true;
- }
- benoit::d::thelog.insert(benoit::d::thelog.begin(),msg);
-}
-void benoit::log(std::string const func,std::string msg) {
- std::string const funcname = "benoit::log(std::string const,std::string)"s;
- msg = fmt::format("[{}] {}"s,func,msg);
-}
diff --git a/src/benoit/logfunc.cc b/src/benoit/logfunc.cc
deleted file mode 100644
index 1a3c0bf..0000000
--- a/src/benoit/logfunc.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <fmt/core.h>
-# include <string>
-using namespace std::literals::string_literals;
-void benoit::logfunc(std::string const func) {
- std::string const funcname = "benoit::logfunc(std::string const)"s;
- benoit::log(fmt::format("\33[33mFunction call\33[0m: {}."s,func));
-}
diff --git a/src/benoit/logfuncret.cc b/src/benoit/logfuncret.cc
deleted file mode 100644
index 5aae060..0000000
--- a/src/benoit/logfuncret.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-# include <benoit/log.hh>
-# include <benoit/logfuncret.hh>
-# include <fmt/core.h>
-# include <string>
-using namespace std::literals::string_literals;
-void benoit::logfuncret(std::string const func) {
- std::string const funcname = "benoit::logfuncret(std::string const)"s;
- benoit::log(fmt::format("\33[35mFunction return\33[0m: {}."s,func));
-}
diff --git a/src/benoit/main.cc b/src/benoit/main.cc
deleted file mode 100644
index fbddfa2..0000000
--- a/src/benoit/main.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-static_assert(((sizeof(short) >= 0x2) && (sizeof(int) >= 0x4) && (sizeof(long) >= 0x4) && (sizeof(long long) >= 0x8) && (sizeof(void *) >= 0x8)),"Benoit expects at least an LLP64 data model.");
-# include <benoit/arghandl.hh>
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/d/numthrds.hh>
-# include <benoit/exit.hh>
-# include <benoit/loadcfg.hh>
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/main.hh>
-# include <benoit/plotmandelbrot.hh>
-# include <benoit/print.hh>
-# include <benoit/wrtimg.hh>
-# include <cstdint>
-# include <cstdlib>
-# include <fmt/core.h>
-# include <string>
-# include <thread>
-using namespace std::literals::string_literals;
-[[noreturn]] void benoit::main(int const argc,char const * * argv) noexcept {
- std::string const funcname = "benoit::main(int const,char const * *)"s;
- benoit::logfunc(funcname);
- benoit::d::numthrds = std::thread::hardware_concurrency();
- benoit::log(fmt::format("{} availabe threads have been detected."s,benoit::d::numthrds));
- benoit::arghandl(argc,argv);
- benoit::loadcfg();
- benoit::wrtimg(benoit::plotmandelbrot());
- benoit::exit(EXIT_SUCCESS);
-}
diff --git a/src/benoit/plotmandelbrot.cc b/src/benoit/plotmandelbrot.cc
deleted file mode 100644
index 6d3b993..0000000
--- a/src/benoit/plotmandelbrot.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-# include <benoit/d/alpha.hh>
-# include <benoit/d/maxiter.hh>
-# include <benoit/d/numthrds.hh>
-# include <benoit/d/pos.hh>
-# include <benoit/d/resx.hh>
-# include <benoit/d/resy.hh>
-# include <benoit/log.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/plotmandelbrot.hh>
-# include <benoit/print.hh>
-# include <benoit/t/thrddat.hh>
-# include <benoit/t/rgba.hh>
-# include <cmath>
-# include <cstdint>
-# include <fmt/core.h>
-# include <pthread.h>
-# include <string>
-# include <vector>
-using namespace std::literals::string_literals;
-namespace {
- void * plotarea(void * thrddatptr) {
- benoit::t::thrddat * thrddat = reinterpret_cast<benoit::t::thrddat *>(thrddatptr);
- for(unsigned long long px = *thrddat->imgbegin;(px <= *thrddat->imgend);++px) {
- unsigned x = (px % benoit::d::resx);
- unsigned y = ((px - (px % benoit::d::resy)) / benoit::d::resy);
- ::__float128 r = x * ((0x2p0 + benoit::d::pos.x * benoit::d::pos.zoom) / benoit::d::pos.zoom - (-0x2p0 + benoit::d::pos.x * benoit::d::pos.zoom) / benoit::d::pos.zoom) / benoit::d::resx + (-0x2p0 + benoit::d::pos.x * benoit::d::pos.zoom) / benoit::d::pos.zoom;
- ::__float128 i = y * ((0x2p0 + benoit::d::pos.y * benoit::d::pos.zoom) / benoit::d::pos.zoom - (-0x2p0 + benoit::d::pos.y * benoit::d::pos.zoom) / benoit::d::pos.zoom) / benoit::d::resx + (-0x2p0 + benoit::d::pos.y * benoit::d::pos.zoom) / benoit::d::pos.zoom;
- ::__float128 r1 = 0x0p0;
- ::__float128 i1 = 0x0p0;
- unsigned long long iter = 0x0ull;
- for(;(iter < benoit::d::maxiter);++iter) {
- if((r1 * r1 + i1 * i1) >= 0x4p0) {
- break;
- }
- ::__float128 r1tmp = (r1 * r1 - i1 * i1 + r);
- ::__float128 i1tmp = (0x2p0 * r1 * i1 + i);
- if((r1 == r1tmp) && (i1 == i1tmp)) {
- iter = benoit::d::maxiter;
- break;
- }
- r1 = r1tmp;
- i1 = i1tmp;
- }
- if(iter != benoit::d::maxiter) {
- float fac = (static_cast<float>(iter) / 0x40p0);
- fac = (fac - std::floor(fac));
- if(fac <= (0x1p0 / 0x4p0)) {
- thrddat->img[px].r = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- thrddat->img[px].g = static_cast<std::uint8_t>(0x0p0);
- thrddat->img[px].b = static_cast<std::uint8_t>(0x0p0);
- }
- else if(fac <= (0x1p0 / 0x2p0)) {
- thrddat->img[px].r = static_cast<std::uint8_t>(0xFFp0);
- thrddat->img[px].g = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- thrddat->img[px].b = static_cast<std::uint8_t>(0x0p0);
- }
- else if(fac <= (0x3p0 / 0x4p0)) {
- thrddat->img[px].r = static_cast<std::uint8_t>(0xFFp0);
- thrddat->img[px].g = static_cast<std::uint8_t>(0xFFp0);
- thrddat->img[px].b = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- }
- else {
- fac = (0x1p0 - fac);
- thrddat->img[px].r = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- thrddat->img[px].g = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- thrddat->img[px].b = static_cast<std::uint8_t>(fac * 0xFFp0 * 0x4p0);
- }
- }
- else {
- thrddat->img[px].a = 0x0u;
- }
- }
- pthread_exit(nullptr);
- }
-}
-std::vector<std::uint8_t> * benoit::plotmandelbrot() {
- std::string const funcname = "benoit::plotmandelbrot()"s;
- benoit::logfunc(funcname);
- unsigned long long const numpx = (benoit::d::resx * benoit::d::resy);
- benoit::log(fmt::format("The image has a total of {} pixels."s,numpx));
- unsigned long long remainpx = numpx;
- benoit::t::rgba * rgbaimg = ::new benoit::t::rgba[numpx];
- std::vector<benoit::t::thrddat> thrds(benoit::d::numthrds);
- for(unsigned thrdid = 0x0;(thrdid < benoit::d::numthrds);++thrdid) {
- benoit::log(fmt::format("Allocating data for thread #{}."s,thrdid));
- thrds[thrdid].id = ::new unsigned(thrdid);
- thrds[thrdid].img = rgbaimg;
- thrds[thrdid].isrun = ::new bool(false);
- thrds[thrdid].thrd = ::new pthread_t;
- }
- for(unsigned thrdid = 0x0,y = 0x0u;(y < benoit::d::resy);++thrdid,++y) {
- if(remainpx == 0x0) {
- break;
- }
- if(thrdid == benoit::d::numthrds) {
- thrdid = 0x0;
- }
- if(*thrds[thrdid].isrun) {
- pthread_join(*thrds[thrdid].thrd,nullptr);
- delete thrds[thrdid].isrun;
- thrds[thrdid].isrun = ::new bool(false);
- }
- thrds[thrdid].imgbegin = ::new unsigned long long(y * benoit::d::resx);
- thrds[thrdid].imgend = ::new unsigned long long(*thrds[thrdid].imgbegin + benoit::d::resx - 0x1);
- ::pthread_create(thrds[thrdid].thrd,nullptr,::plotarea,&thrds[thrdid]);
- delete thrds[thrdid].isrun;
- thrds[thrdid].isrun = ::new bool(true);
- }
- for(auto thrd : thrds) {
- benoit::log(fmt::format("Destroying thread #{}'s data."s,*thrd.id));
- if(*thrd.isrun) {
- ::pthread_join(*thrd.thrd,nullptr);
- }
- thrd.img = nullptr;
- ::delete thrd.id;
- ::delete thrd.imgbegin;
- ::delete thrd.imgend;
- ::delete thrd.isrun;
- ::delete thrd.thrd;
- }
- std::vector<std::uint8_t> * img = ::new std::vector<std::uint8_t>;
- for(unsigned long long pos = 0x0ull;(pos < numpx);++pos) {
- img->push_back(rgbaimg[pos].r);
- img->push_back(rgbaimg[pos].g);
- img->push_back(rgbaimg[pos].b);
- if(benoit::d::alpha) {
- img->push_back(rgbaimg[pos].a);
- }
- else {
- img->push_back(0xFF);
- }
- }
- ::delete[] rgbaimg;
- benoit::logfuncret(funcname);
- return img;
-}
diff --git a/src/benoit/print.cc b/src/benoit/print.cc
deleted file mode 100644
index 6d9d953..0000000
--- a/src/benoit/print.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-# include <benoit/d/thelog.hh>
-# include <benoit/d/printdolog.hh>
-# include <benoit/print.hh>
-# include <fcntl.h>
-# include <stdexcept>
-# include <string>
-# include <unistd.h>
-using namespace std::literals::string_literals;
-void benoit::print(std::string msg,bool stderr) {
- std::string const funcname = "benoit::print(std::string,bool)"s;
- if(benoit::d::printdolog) {
- benoit::d::thelog.insert(benoit::d::thelog.begin(),msg);
- }
- msg.append("\u000A"s);
- int fil = 0x0;
- if(stderr) {
- fil = 0x1;
- }
- if(::write(fil,msg.c_str(),msg.size()) < 0x0) {
- throw std::runtime_error("Unable to write to Stdout.");
- }
- fsync(fil);
-}
diff --git a/src/benoit/t/pos/pos.cc b/src/benoit/t/pos/pos.cc
deleted file mode 100644
index 50fa2df..0000000
--- a/src/benoit/t/pos/pos.cc
+++ /dev/null
@@ -1,5 +0,0 @@
-# include <benoit/t/pos.hh>
-benoit::t::pos::pos(__float128 x,__float128 y) {
- this->x = x;
- this->y = y;
-}
diff --git a/src/benoit/wrtimg.cc b/src/benoit/wrtimg.cc
deleted file mode 100644
index 1053a9e..0000000
--- a/src/benoit/wrtimg.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-# include <benoit/d/imgfmt.hh>
-# include <benoit/d/outimg.hh>
-# include <benoit/d/resx.hh>
-# include <benoit/d/resy.hh>
-# include <benoit/err/clsfil.hh>
-# include <benoit/err/wrttofil.hh>
-# include <benoit/logfunc.hh>
-# include <benoit/logfuncret.hh>
-# include <benoit/print.hh>
-# include <benoit/t/imgfmt.hh>
-# include <benoit/wrtimg.hh>
-# include <cstdint>
-# include <cstdlib>
-# include <fcntl.h>
-# include <fmt/core.h>
-# include <png.h>
-# include <string>
-# include <sys/types.h>
-# include <unistd.h>
-# include <vector>
-# include <webp/encode.h>
-# include <webp/types.h>
-using namespace std::literals::string_literals;
-void benoit::wrtimg(std::vector<std::uint8_t> * img) {
- std::string const funcname = "benoit::wrtimg(std::vector<std::uint8_t> *)"s;
- benoit::logfunc(funcname);
- std::uint8_t * dat;
- unsigned long long datsiz = 0x0;
- switch(benoit::d::imgfmt) {
- case benoit::t::imgfmt::png:
- break;
- case benoit::t::imgfmt::webp:
- datsiz = WebPEncodeLosslessRGBA(img->data(),benoit::d::resx,benoit::d::resy,(benoit::d::resx * 0x4),&dat);
- break;
- }
- int fil = ::open(benoit::d::outimg.c_str(),(O_CREAT | O_TRUNC | O_WRONLY),0x1B4);
- for(unsigned long long pos = 0x0;(pos < datsiz);++pos) {
- ::ssize_t byteswrtn = ::write(fil,&dat[pos],0x1);
- if(byteswrtn < 0x0) {
- benoit::err::wrttofil(benoit::d::outimg);
- return;
- }
- }
- delete dat;
- delete img;
- if(::close(fil) < 0x0) {
- benoit::err::clsfil(benoit::d::outimg);
- }
- benoit::logfuncret(funcname);
-}
-/*
-auto webpconf = ::WebPConfig();
-webpconf.lossless = 0x1;
-webpconf.quality = 0x64;
-webpconf.method = 0x6;
-webpconf.segments = 0x4;
-webpconf.sns_strength = 0x4;
-webpconf.filter_strength = 0x0;
-webpconf.filter_sharpness = 0x0;
-webpconf.autofilter = 0x0;
-webpconf.alpha_compression = 0x1;
-webpconf.alpha_filtering = 0x2;
-webpconf.alpha_quality = 0x64;
-webpconf.pass = 0xA;
-webpconf.preprocessing = 0x1;
-webpconf.partitions = 0x3;
-webpconf.partitions = 0x0;
-webpconf.use_sharp_yuv = 0x0;
-auto conferr = ::WebPValidateConfig(&webpconf);
-auto webpimg = ::WebPPicture();
-WebPPictureInit(&webpimg);
-webpimg.use_argb = 0x1;
-webpimg.resx = 0x1;
-webpimg.resy = 0x1;
-WebPPictureAlloc(&webpimg);
-auto webpmemwrit = WebPMemoryWriter();
-WebPMemoryWriterInit(&webpmemwrit);
-webpimg.writer = WebPMemoryWrite;
-webpimg.custom_ptr = &webpmemwrit;
-webpimg.argb = {0xFF,0xFF,0x0,0x0};
-if(WebPEncode(&webpconf,&webpimg) == 0x0) {
-}
-else {
-
-}
-WebPPictureFree(&webpimg);
-auto buf = std::vector<std::uint8_t>();
-buf.push_back(0xFF);
-buf.push_back(0x0);
-buf.push_back(0x0);
-auto fil = std::fstream(benoit::outimt,std::fstream::binary | std::fstream::out | std::fstream::trunc);
-if(!fil.is_open()) {
- ::_exit(EXIT_FAILURE);
-}
-*/
diff --git a/src/main.cc b/src/main.cc
deleted file mode 100644
index a6341a6..0000000
--- a/src/main.cc
+++ /dev/null
@@ -1,4 +0,0 @@
-# include <benoit/main.hh>
-int main(int const argc,char const * * argv) {
- benoit::main(argc,argv);
-}