summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--Cargo.toml18
-rw-r--r--README.md64
-rw-r--r--changelog.md127
-rw-r--r--include/benoit/archstr.hh6
-rw-r--r--include/benoit/arghandl.hh4
-rw-r--r--include/benoit/crtcfg.hh4
-rw-r--r--include/benoit/d/alpha.hh6
-rw-r--r--include/benoit/d/arch.hh18
-rw-r--r--include/benoit/d/cfg.hh7
-rw-r--r--include/benoit/d/debug.hh11
-rw-r--r--include/benoit/d/dobt.hh6
-rw-r--r--include/benoit/d/imgfmt.hh7
-rw-r--r--include/benoit/d/kernel.hh26
-rw-r--r--include/benoit/d/logdoprint.hh6
-rw-r--r--include/benoit/d/maxiter.hh6
-rw-r--r--include/benoit/d/numthrds.hh6
-rw-r--r--include/benoit/d/outimg.hh7
-rw-r--r--include/benoit/d/pos.hh7
-rw-r--r--include/benoit/d/printdolog.hh6
-rw-r--r--include/benoit/d/resx.hh6
-rw-r--r--include/benoit/d/resy.hh6
-rw-r--r--include/benoit/d/thelog.hh8
-rw-r--r--include/benoit/d/ver.hh6
-rw-r--r--include/benoit/err/clsfil.hh7
-rw-r--r--include/benoit/err/wrttofil.hh7
-rw-r--r--include/benoit/exit.hh6
-rw-r--r--include/benoit/helpscrn.hh4
-rw-r--r--include/benoit/kernelstr.hh6
-rw-r--r--include/benoit/loadcfg.hh4
-rw-r--r--include/benoit/log.hh6
-rw-r--r--include/benoit/logfunc.hh5
-rw-r--r--include/benoit/logfuncret.hh5
-rw-r--r--include/benoit/main.hh4
-rw-r--r--include/benoit/plotmandelbrot.hh6
-rw-r--r--include/benoit/print.hh5
-rw-r--r--include/benoit/t/arch.hh12
-rw-r--r--include/benoit/t/imgfmt.hh9
-rw-r--r--include/benoit/t/kernel.hh16
-rw-r--r--include/benoit/t/pos.hh12
-rw-r--r--include/benoit/t/rgba.hh13
-rw-r--r--include/benoit/t/thrddat.hh17
-rw-r--r--include/benoit/wrtimg.hh6
-rw-r--r--source/benoit/benoit.rs24
-rw-r--r--source/benoit/benoit/application.rs42
-rw-r--r--source/benoit/benoit/application/initialise.rs49
-rw-r--r--source/benoit/benoit/application/render.rs86
-rw-r--r--source/benoit/benoit/application/run.rs45
-rw-r--r--source/benoit/main.rs31
-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
80 files changed, 371 insertions, 1322 deletions
diff --git a/.gitignore b/.gitignore
index 674bb53..d196ecb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-*.json
-*.o
*.png
*.webp
-/benoit
+/old
+/target
+Cargo.lock
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..2580430
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "benoit"
+version = "0.12.0"
+authors = ["Gabriel Bjørnager Jensen"]
+edition = "2021"
+description = "Mandelbrot renderer."
+readme = "README.md"
+repository = "https://mandelbrot.dk/benoit"
+
+[[bin]]
+name = "benoit"
+path = "source/benoit/main.rs"
+
+[profile.release]
+lto = true
+
+[dependencies]
+sdl2 = "0.35.2"
diff --git a/README.md b/README.md
index 5c52320..a48071f 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,13 @@
-<center>
- <img src="https://fadaesen.dk/files/benoit.svg" style="width:16em" />
-</center>
+# Benoit
-# benoit
+[*Benoit*](https://mandelbrot.dk/benoit) is a free and open-source Mandelbrot renderer written in Rust. It is aimed at producing accurate renders at arbitrary positions in the set as fast as possible.
-[*benoit*](https://mandelbrot.dk/delta/benoit) is a free and open-source Mandelbrot renderer written in C++ aimed at producing accurate Mandelbrot renders at arbitrary positions in the set as fast as possible.
+# Copyright & License
-This speed is achieved by using as many of the host's avaialable CPUs as possible.
-
-For information regarding copyright of the software and it's license, please read the *Copyright & License* section down below.
-
-## Building
-
-The included Makefile is supposed to work.
-
-In the event it doesn't, find a solution.
-
-## Dependencies
-
-This project depends on the following libraries:
-
-* [*{FMT}*](https://github.com/fmtlib/fmt) for string-formatting.
-* [*libpng*](https://github.com/glennrp/libpng) for encoding PNG images.
-* [*libwebp*](https://chromium.googlesource.com/webm/libwebp) for encoding WebP images.
-
-The project requires the target system to use the LLP64 data-model or greater.
-
-## Copyright & License
-
-Copyright (c) 2021 Gabriel Jensen.
-
-All rights reserved.
+Copyright 2021, 2023 Gabriel Bjørnager Jensen.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License along with this program.
-
-If not, see <https://www.gnu.org/licenses/>.
-
-## Questions
-
-### Why 64b-only?
-
-64b architectures use 32b to represent an `int`, while 32b architectures use 16b.
-
-32b systems are being deprecated by a lot of entities, and therefore it makes life easier to just expect a 64b data-mode. Why even bother, right?
-
-Well actually some embedded-systems use 32b processors, and to the user of those I say: *Suck my big duck!*
-
-### Why *blah blah blah*?
-
-Please ask a constructive question.
-
-### Why “benoit”?
-
-This project is named *benoit* in honour of Benoit Mandelbrot, the discoverer of the, you guessed it, Mandelbrot set.
-
-Benoit was a cool dude, but most people remember him only under the name *Mandelbrot*, if at all.
+This program 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 Affero General Public License for more details.
-I think Benoit is a cool name, and Mr. Mandelbrot was a cool dude, so why not make a cool programme named after two cool things?
+You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/changelog.md b/changelog.md
index 7601586..918f095 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,95 +1,102 @@
+# 10
+
+* Rewrite in Rust again
+* Update gitignore
+* Update readme
+* Update changelog format
+
# ↋
-* Drop *boost::multiprecision::mpfr_float* in favour of the standard type *::__float128* for multiprecision.
-* Create a prettier colour palette.
-* Use JSON instead of XML for configuration.
-* Automatically create a configuration file if one doesn't already exist.
-* Greatly improve render time.
+* Drop *boost::multiprecision::mpfr_float* in favour of the standard type *::__float128* for multiprecision
+* Create a prettier colour palette
+* Use JSON instead of XML for configuration
+* Automatically create a configuration file if one doesn't already exist
+* Greatly improve render time
# ↊
-* Fix #3.
-* Implement a working, multithreaded renderer forked from MandelbrotSDL.
-* Add more command-line options.
+* Fix #3
+* Implement a working, multithreaded renderer forked from MandelbrotSDL
+* Add more command-line options
# 9
-* Remove *\*.ppm* from *.gitignore*.
-* Reformat changelog from HTML to Markdown.
-* Add an alpha channel to the image data.
-* Use *std::from_chars* instead of *std::stoi* in argument handler.
-* Inline the *benoit::wrtimg::iterwrt* lambda expression.
+* Remove *\*.ppm* from *.gitignore*
+* Reformat changelog from HTML to Markdown
+* Add an alpha channel to the image data
+* Use *std::from_chars* instead of *std::stoi* in argument handler
+* Inline the *benoit::wrtimg::iterwrt* lambda expression
# 8
-* Fix #2.
+* Fix #2
# 7
-* Fix #1.
-* Fix some language mistakes.
-* Add a *Copyright & License* page in *README.md*.
-* Create logo.
-* Update *README.md*.
+* Fix #1
+* Fix some language mistakes
+* Add a *Copyright & License* page in *README.md*
+* Create logo
+* Update *README.md*
# 6
-* Actually switch compiler from Clang++ to G++.
-* Add more command-line arguments.
-* Move all data variables into seperate files.
-* Update *README.md*.
-* Remove PPM as a supported format.
-* Change maximum resolution to 65536.
-* Change maximum number of threads to 65536.
-* Fix WebP encoding.
-* Create temporary renderer that renders a *test* image using multiple threads.
+* Actually switch compiler from Clang++ to G++
+* Add more command-line arguments
+* Move all data variables into seperate files
+* Update *README.md*
+* Remove PPM as a supported format
+* Change maximum resolution to 65536
+* Change maximum number of threads to 65536
+* Fix WebP encoding
+* Create temporary renderer that renders a *test* image using multiple threads
# 5
-* Automatically detect number of threads.
-* Improve debugging.
-* Enable POSIX C.
-* Create foundation for loading and creating XML configurations.
-* Improve help screen.
-* Fix the static_assert in *include/benoit.hh* comparing to bits instead of bytes.
-* Switch compiler from Clang++ to G++ as it has better C++20 support.
-* Rework code structure.
-* Resize maximum resolution from *65535* to *4294967295*.
-* Make renderer able to create and use threads.
-* Create *purge* target in Makefile.
+* Automatically detect number of threads
+* Improve debugging
+* Enable POSIX C
+* Create foundation for loading and creating XML configurations
+* Improve help screen
+* Fix the static_assert in *include/benoit.hh* comparing to bits instead of bytes
+* Switch compiler from Clang++ to G++ as it has better C++20 support
+* Rework code structure
+* Resize maximum resolution from *65535* to *4294967295*
+* Make renderer able to create and use threads
+* Create *purge* target in Makefile
# 4
-* Remove build artifacts.
-* Update .gitignore to ignore more build artifacts.
+* Remove build artifacts
+* Update .gitignore to ignore more build artifacts
# 3
-* Remove unused variables from Makefile.
-* Require the LLP64 data model when compiling.
-* Create working multithreaded example.
-* Depend also on libpng.
-* Remove JPEG as a supported image format.
+* Remove unused variables from Makefile
+* Require the LLP64 data model when compiling
+* Create working multithreaded example
+* Depend also on libpng
+* Remove JPEG as a supported image format
# 2
-* Cleanup code.
-* Create argument handler.
-* Create better support for different image formats.
-* Remove C-string functions in favour of the ones in &ltcstring&gt.
-* Greatly improve debugging.
-* Create foundation for new multithreaded multiprecision renderer.
-* Remove old renderer.
-* Completely remove Rust artifacts.
+* Cleanup code
+* Create argument handler
+* Create better support for different image formats
+* Remove C-string functions in favour of the ones in &ltcstring&gt
+* Greatly improve debugging
+* Create foundation for new multithreaded multiprecision renderer
+* Remove old renderer
+* Completely remove Rust artifacts
# 1
-* Add changelog.
-* Add README.
-* Move codebase to C++.
-* Copy renderer from MandelbrotSDL.
-* Change default filetype to PPM.
+* Add changelog
+* Add README
+* Move codebase to C++
+* Copy renderer from MandelbrotSDL
+* Change default filetype to PPM
# 0
-* First.
+* First
diff --git a/include/benoit/archstr.hh b/include/benoit/archstr.hh
deleted file mode 100644
index 3403d6a..0000000
--- a/include/benoit/archstr.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <benoit/t/arch.hh>
-# include <string>
-namespace benoit {
- std::string archstr(benoit::t::arch arch) noexcept;
-}
diff --git a/include/benoit/arghandl.hh b/include/benoit/arghandl.hh
deleted file mode 100644
index 4060149..0000000
--- a/include/benoit/arghandl.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-# pragma once
-namespace benoit {
- void arghandl(int const & argc,char const * * & argv);
-}
diff --git a/include/benoit/crtcfg.hh b/include/benoit/crtcfg.hh
deleted file mode 100644
index 957399e..0000000
--- a/include/benoit/crtcfg.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-# pragma once
-namespace benoit {
- void crtcfg();
-}
diff --git a/include/benoit/d/alpha.hh b/include/benoit/d/alpha.hh
deleted file mode 100644
index 49f176b..0000000
--- a/include/benoit/d/alpha.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- bool extern alpha;
- }
-}
diff --git a/include/benoit/d/arch.hh b/include/benoit/d/arch.hh
deleted file mode 100644
index 71d8feb..0000000
--- a/include/benoit/d/arch.hh
+++ /dev/null
@@ -1,18 +0,0 @@
-# pragma once
-# include <benoit/t/arch.hh>
-namespace benoit {
- namespace d {
- benoit::t::arch constexpr arch =
-# if defined(__aarch64__)
- benoit::t::arch::aarch64;
-# elif (defined(_M_AMD64) || defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(x86_64__))
- benoit::t::arch::amd64;
-# elif (defined(_IA64) defined(_M_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__itanium__))
- benoit::t::arch::ia64;
-# elif (defined(_ARCH_PPC64) || defined(__powerpc64__) || defined(__PPC64__) || defined(__ppc64__))
- benoit::t::arch::ppc64;
-# else
- benoit::t::arch::unknown;
-# endif
- }
-}
diff --git a/include/benoit/d/cfg.hh b/include/benoit/d/cfg.hh
deleted file mode 100644
index e2b2bf5..0000000
--- a/include/benoit/d/cfg.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- namespace d {
- std::string extern cfg;
- }
-}
diff --git a/include/benoit/d/debug.hh b/include/benoit/d/debug.hh
deleted file mode 100644
index 015eb17..0000000
--- a/include/benoit/d/debug.hh
+++ /dev/null
@@ -1,11 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- bool constexpr debug =
-# if defined(NDEBUG)
- false;
-# else
- true;
-# endif
- }
-}
diff --git a/include/benoit/d/dobt.hh b/include/benoit/d/dobt.hh
deleted file mode 100644
index 149eabb..0000000
--- a/include/benoit/d/dobt.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- bool extern dobt;
- }
-}
diff --git a/include/benoit/d/imgfmt.hh b/include/benoit/d/imgfmt.hh
deleted file mode 100644
index 58bbc5f..0000000
--- a/include/benoit/d/imgfmt.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <benoit/t/imgfmt.hh>
-namespace benoit {
- namespace d {
- benoit::t::imgfmt extern imgfmt;
- }
-}
diff --git a/include/benoit/d/kernel.hh b/include/benoit/d/kernel.hh
deleted file mode 100644
index b11d9a0..0000000
--- a/include/benoit/d/kernel.hh
+++ /dev/null
@@ -1,26 +0,0 @@
-# pragma once
-# include <benoit/t/kernel.hh>
-namespace benoit {
- namespace d {
- benoit::t::kernel constexpr kernel =
-# if (defined(Macintosh) || defined(macintosh) || defined(__APPLE__) || defined(__MACH__))
- benoit::t::kernel::darwinos;
-# elif defined(__DragonFly__)
- benoit::t::kernel::dragonflybsd;
-# elif defined(__FreeBSD__)
- benoit::t::kernel::freebsd;
-# elif (defined(__GNU__) || defined(__gnu_hurd__))
- benoit::t::kernel::hurd;
-# elif defined(__linux__)
- benoit::t::kernel::linux;
-# elif defined(__minix)
- benoit::t::kernel::minix;
-# elif defined(__NetBSD__)
- benoit::t::kernel::netbsd;
-# elif defined(__OpenBSD__)
- benoit::t::kernel::openbsd;
-# else
- benoit::t::kernel::unknown;
-# endif
- }
-}
diff --git a/include/benoit/d/logdoprint.hh b/include/benoit/d/logdoprint.hh
deleted file mode 100644
index 801c134..0000000
--- a/include/benoit/d/logdoprint.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- bool extern logdoprint;
- }
-}
diff --git a/include/benoit/d/maxiter.hh b/include/benoit/d/maxiter.hh
deleted file mode 100644
index 00fc555..0000000
--- a/include/benoit/d/maxiter.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- unsigned long long extern maxiter;
- }
-}
diff --git a/include/benoit/d/numthrds.hh b/include/benoit/d/numthrds.hh
deleted file mode 100644
index 459f994..0000000
--- a/include/benoit/d/numthrds.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- unsigned extern numthrds;
- }
-}
diff --git a/include/benoit/d/outimg.hh b/include/benoit/d/outimg.hh
deleted file mode 100644
index cfcd7df..0000000
--- a/include/benoit/d/outimg.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- namespace d {
- std::string extern outimg;
- }
-}
diff --git a/include/benoit/d/pos.hh b/include/benoit/d/pos.hh
deleted file mode 100644
index afaeb1d..0000000
--- a/include/benoit/d/pos.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <benoit/t/pos.hh>
-namespace benoit {
- namespace d {
- benoit::t::pos extern pos;
- }
-}
diff --git a/include/benoit/d/printdolog.hh b/include/benoit/d/printdolog.hh
deleted file mode 100644
index 85c58bc..0000000
--- a/include/benoit/d/printdolog.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- bool extern printdolog;
- }
-}
diff --git a/include/benoit/d/resx.hh b/include/benoit/d/resx.hh
deleted file mode 100644
index c90a790..0000000
--- a/include/benoit/d/resx.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- unsigned extern resx;
- }
-}
diff --git a/include/benoit/d/resy.hh b/include/benoit/d/resy.hh
deleted file mode 100644
index 7d502a8..0000000
--- a/include/benoit/d/resy.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- unsigned extern resy;
- }
-}
diff --git a/include/benoit/d/thelog.hh b/include/benoit/d/thelog.hh
deleted file mode 100644
index edceb32..0000000
--- a/include/benoit/d/thelog.hh
+++ /dev/null
@@ -1,8 +0,0 @@
-# pragma once
-# include <string>
-# include <vector>
-namespace benoit {
- namespace d {
- std::vector<std::string> extern thelog;
- }
-}
diff --git a/include/benoit/d/ver.hh b/include/benoit/d/ver.hh
deleted file mode 100644
index 42fc054..0000000
--- a/include/benoit/d/ver.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-namespace benoit {
- namespace d {
- unsigned long long constexpr ver = 0xB;
- }
-}
diff --git a/include/benoit/err/clsfil.hh b/include/benoit/err/clsfil.hh
deleted file mode 100644
index ed853b9..0000000
--- a/include/benoit/err/clsfil.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- namespace err {
- void clsfil(std::string const fil) noexcept;
- }
-}
diff --git a/include/benoit/err/wrttofil.hh b/include/benoit/err/wrttofil.hh
deleted file mode 100644
index 232d431..0000000
--- a/include/benoit/err/wrttofil.hh
+++ /dev/null
@@ -1,7 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- namespace err {
- void wrttofil(std::string const fil) noexcept;
- }
-}
diff --git a/include/benoit/exit.hh b/include/benoit/exit.hh
deleted file mode 100644
index bcf487d..0000000
--- a/include/benoit/exit.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <string>
-using namespace std::string_literals;
-namespace benoit {
- [[noreturn]] void exit(int code,std::string msg = ""s) noexcept;
-}
diff --git a/include/benoit/helpscrn.hh b/include/benoit/helpscrn.hh
deleted file mode 100644
index 66eea36..0000000
--- a/include/benoit/helpscrn.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-# pragma once
-namespace benoit {
- [[noreturn]] void helpscrn() noexcept;
-}
diff --git a/include/benoit/kernelstr.hh b/include/benoit/kernelstr.hh
deleted file mode 100644
index 9ad0746..0000000
--- a/include/benoit/kernelstr.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <benoit/t/kernel.hh>
-# include <string>
-namespace benoit {
- std::string kernelstr(benoit::t::kernel kernel) noexcept;
-}
diff --git a/include/benoit/loadcfg.hh b/include/benoit/loadcfg.hh
deleted file mode 100644
index 10273b0..0000000
--- a/include/benoit/loadcfg.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-# pragma once
-namespace benoit {
- void loadcfg();
-}
diff --git a/include/benoit/log.hh b/include/benoit/log.hh
deleted file mode 100644
index 6c04e76..0000000
--- a/include/benoit/log.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- void log(std::string msg);
- void log(std::string const func,std::string msg);
-}
diff --git a/include/benoit/logfunc.hh b/include/benoit/logfunc.hh
deleted file mode 100644
index 35daec8..0000000
--- a/include/benoit/logfunc.hh
+++ /dev/null
@@ -1,5 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- void logfunc(std::string const func);
-}
diff --git a/include/benoit/logfuncret.hh b/include/benoit/logfuncret.hh
deleted file mode 100644
index 1db2e41..0000000
--- a/include/benoit/logfuncret.hh
+++ /dev/null
@@ -1,5 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- void logfuncret(std::string const func);
-}
diff --git a/include/benoit/main.hh b/include/benoit/main.hh
deleted file mode 100644
index 72e7051..0000000
--- a/include/benoit/main.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-# pragma once
-namespace benoit {
- [[noreturn]] void main(int const argc,char const * * argv) noexcept;
-}
diff --git a/include/benoit/plotmandelbrot.hh b/include/benoit/plotmandelbrot.hh
deleted file mode 100644
index f79b247..0000000
--- a/include/benoit/plotmandelbrot.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <cstdint>
-# include <vector>
-namespace benoit {
- std::vector<std::uint8_t> * plotmandelbrot();
-}
diff --git a/include/benoit/print.hh b/include/benoit/print.hh
deleted file mode 100644
index 0f85fd3..0000000
--- a/include/benoit/print.hh
+++ /dev/null
@@ -1,5 +0,0 @@
-# pragma once
-# include <string>
-namespace benoit {
- void print(std::string msg,bool stderr = false);
-}
diff --git a/include/benoit/t/arch.hh b/include/benoit/t/arch.hh
deleted file mode 100644
index 622e70d..0000000
--- a/include/benoit/t/arch.hh
+++ /dev/null
@@ -1,12 +0,0 @@
-# pragma once
-namespace benoit {
- namespace t {
- enum class arch {
- aarch64,
- amd64,
- ia64,
- ppc64,
- unknown,
- };
- }
-}
diff --git a/include/benoit/t/imgfmt.hh b/include/benoit/t/imgfmt.hh
deleted file mode 100644
index 7efed27..0000000
--- a/include/benoit/t/imgfmt.hh
+++ /dev/null
@@ -1,9 +0,0 @@
-# pragma once
-namespace benoit {
- namespace t {
- enum class imgfmt {
- png,
- webp,
- };
- }
-}
diff --git a/include/benoit/t/kernel.hh b/include/benoit/t/kernel.hh
deleted file mode 100644
index 099dd60..0000000
--- a/include/benoit/t/kernel.hh
+++ /dev/null
@@ -1,16 +0,0 @@
-# pragma once
-namespace benoit {
- namespace t {
- enum class kernel {
- darwinos,
- dragonflybsd,
- freebsd,
- hurd,
- linux,
- minix,
- netbsd,
- openbsd,
- unknown,
- };
- }
-}
diff --git a/include/benoit/t/pos.hh b/include/benoit/t/pos.hh
deleted file mode 100644
index 697fdef..0000000
--- a/include/benoit/t/pos.hh
+++ /dev/null
@@ -1,12 +0,0 @@
-# pragma once
-namespace benoit {
- namespace t {
- class pos {
- public:
- pos(__float128 x = 0x0,__float128 y = 0x0);
- __float128 x = 0x0;
- __float128 y = 0x0;
- __float128 zoom = 0x1;
- };
- }
-}
diff --git a/include/benoit/t/rgba.hh b/include/benoit/t/rgba.hh
deleted file mode 100644
index a1bdcf7..0000000
--- a/include/benoit/t/rgba.hh
+++ /dev/null
@@ -1,13 +0,0 @@
-# pragma once
-# include <cstdint>
-namespace benoit {
- namespace t {
- class rgba {
- public:
- std::uint8_t a = 0xFFu;
- std::uint8_t b = 0x0u;
- std::uint8_t g = 0x0u;
- std::uint8_t r = 0x0u;
- };
- }
-}
diff --git a/include/benoit/t/thrddat.hh b/include/benoit/t/thrddat.hh
deleted file mode 100644
index 85b3bfb..0000000
--- a/include/benoit/t/thrddat.hh
+++ /dev/null
@@ -1,17 +0,0 @@
-# pragma once
-# include <benoit/t/rgba.hh>
-# include <cstdint>
-# include <pthread.h>
-namespace benoit {
- namespace t {
- class thrddat {
- public:
- benoit::t::rgba * img = nullptr;
- bool * isrun = nullptr;
- pthread_t * thrd = nullptr;
- unsigned * id = nullptr;
- unsigned long long * imgbegin = nullptr;
- unsigned long long * imgend = nullptr;
- };
- }
-}
diff --git a/include/benoit/wrtimg.hh b/include/benoit/wrtimg.hh
deleted file mode 100644
index ce4880b..0000000
--- a/include/benoit/wrtimg.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-# pragma once
-# include <cstdint>
-# include <vector>
-namespace benoit {
- void wrtimg(std::vector<std::uint8_t> * img);
-}
diff --git a/source/benoit/benoit.rs b/source/benoit/benoit.rs
new file mode 100644
index 0000000..5b4b9e2
--- /dev/null
+++ b/source/benoit/benoit.rs
@@ -0,0 +1,24 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+pub mod application;
diff --git a/source/benoit/benoit/application.rs b/source/benoit/benoit/application.rs
new file mode 100644
index 0000000..b9f1645
--- /dev/null
+++ b/source/benoit/benoit/application.rs
@@ -0,0 +1,42 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+extern crate sdl2;
+
+use sdl2::{Sdl, VideoSubsystem};
+use sdl2::render::WindowCanvas;
+
+pub mod initialise;
+pub mod render;
+pub mod run;
+
+pub struct Application {
+ sdl: Sdl,
+ sdl_video: VideoSubsystem,
+ canvas: WindowCanvas,
+
+ canvas_width: u32,
+ canvas_height: u32,
+
+ max_iteration_count: u32,
+}
diff --git a/source/benoit/benoit/application/initialise.rs b/source/benoit/benoit/application/initialise.rs
new file mode 100644
index 0000000..724b8d1
--- /dev/null
+++ b/source/benoit/benoit/application/initialise.rs
@@ -0,0 +1,49 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+use crate::benoit::application::Application;
+
+impl Application {
+ pub fn initialise() -> Application {
+ let canvas_width = 0x400;
+ let canvas_height = 0x400;
+
+ let sdl = sdl2::init().expect("unable to initialise sdl2");
+ let sdl_video = sdl.video().expect("unable to initialise video");
+
+ let window = sdl_video.window("Benoit", canvas_width, canvas_height).position_centered().build().expect("unable to open window");
+
+ let canvas = window.into_canvas().build().expect("unable to create canvas");
+
+ return Application {
+ sdl: sdl,
+ sdl_video: sdl_video,
+ canvas: canvas,
+
+ canvas_width: canvas_width,
+ canvas_height: canvas_height,
+
+ max_iteration_count: 0xFF,
+ };
+ }
+}
diff --git a/source/benoit/benoit/application/render.rs b/source/benoit/benoit/application/render.rs
new file mode 100644
index 0000000..6b0dc2f
--- /dev/null
+++ b/source/benoit/benoit/application/render.rs
@@ -0,0 +1,86 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+use crate::benoit::application::Application;
+
+extern crate sdl2;
+
+use sdl2::pixels::Color;
+use sdl2::rect::Rect;
+
+impl Application {
+ pub fn render(&mut self) {
+ println!("rendering");
+
+ //let mut data: [i8; 0x100] = [0; 0x100];
+
+ for y in 0x0..self.canvas_width {
+ for x in 0x0..self.canvas_height {
+ let pixel = y * 0xFF + x;
+
+ let canvas_width = self.canvas_width as f64;
+ let canvas_height = self.canvas_height as f64;
+
+ let ca = (x as f64 - canvas_width / 2.0) / (canvas_width / 4.0);
+ let cb = (y as f64 - canvas_height / 2.0) / (canvas_height / 4.0);
+
+ let mut za = 0.0f64;
+ let mut zb = 0.0f64;
+
+ let mut iteration_count = 0x0u32;
+ while iteration_count < self.max_iteration_count {
+ let distance = (za.powf(2.0) + zb.powf(2.0)).sqrt();
+ if distance > 2.0 { break }
+
+ // z = z^2 + c
+ {
+ // Complex square:
+ // a = a^2 - b^2
+ // b = 2abi
+ let za_temporary = za;
+ za = za.powf(2.0) - zb.powf(2.0) + ca;
+ zb = za_temporary * zb * 2.0 + cb;
+ }
+
+ iteration_count += 0x1;
+ }
+
+ let value = (iteration_count / self.max_iteration_count * 0xFF) as u8;
+ let colour = Color::RGB(value, value, value);
+ self.canvas.set_draw_color(colour);
+
+ let square = Rect::new(
+ x as i32,
+ y as i32,
+ 0x1,
+ 0x1,
+ );
+ self.canvas.fill_rects(&[square]).unwrap();
+ }
+ }
+
+ self.canvas.present();
+
+ println!("done");
+ }
+}
diff --git a/source/benoit/benoit/application/run.rs b/source/benoit/benoit/application/run.rs
new file mode 100644
index 0000000..2505e7e
--- /dev/null
+++ b/source/benoit/benoit/application/run.rs
@@ -0,0 +1,45 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+use crate::benoit::application::Application;
+
+extern crate sdl2;
+
+use sdl2::event::Event;
+
+impl Application {
+ pub fn run(&mut self) {
+ let mut event_pump = self.sdl.event_pump().expect("unable to get event pump");
+
+ self.render();
+
+ 'main_loop: loop {
+ for event in event_pump.poll_iter() {
+ match event {
+ Event::Quit {..} => break 'main_loop,
+ _ => {},
+ }
+ }
+ }
+ }
+}
diff --git a/source/benoit/main.rs b/source/benoit/main.rs
new file mode 100644
index 0000000..bffc05d
--- /dev/null
+++ b/source/benoit/main.rs
@@ -0,0 +1,31 @@
+/*
+ Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+
+ This file is part of Benoit.
+
+ Benoit is free software: you can redistribute it
+ and/or modify it under the terms of the GNU
+ Affero General Public License as published by
+ the Free Software Foundation, either version 3
+ of the License, or (at your option) any later
+ version.
+
+ Benoit 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU
+ Affero General Public License along with Benoit.
+ If not, see <https://www.gnu.org/licenses/>.
+*/
+
+mod benoit;
+
+use benoit::application::Application;
+
+fn main() {
+ let mut application = Application::initialise();
+ application.run();
+}
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);
-}