summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CHANGELOG.txt320
-rw-r--r--CMakeLists.txt296
-rw-r--r--README.html33
-rw-r--r--README.md87
-rw-r--r--changelog.md315
-rw-r--r--dux-demo/CMakeLists.txt45
-rw-r--r--dux-demo/ctest.c46
-rw-r--r--dux-demo/main.cc251
-rw-r--r--dux/CMakeLists.txt134
-rw-r--r--dux/include-priv/dux/c/priv.h18
-rw-r--r--dux/include-priv/dux/cxx/priv.hh (renamed from include/dux/cstr.hh)24
-rw-r--r--dux/include-priv/dux/priv30
-rw-r--r--dux/include-priv/dux/priv.h41
-rw-r--r--dux/include/dux/arr (renamed from include/dux/base)9
-rw-r--r--dux/include/dux/arr.h99
-rw-r--r--dux/include/dux/base30
-rw-r--r--dux/include/dux/base.h558
-rw-r--r--dux/include/dux/c/base.h128
-rw-r--r--dux/include/dux/c/io.h (renamed from include/dux/algo.d/fma.hh)10
-rw-r--r--dux/include/dux/c/math.h60
-rw-r--r--dux/include/dux/c/media.h (renamed from include/dux/arr)10
-rw-r--r--dux/include/dux/c/mem.h23
-rw-r--r--dux/include/dux/c/seq.h (renamed from include/dux/algo.d/isnan.hh)9
-rw-r--r--dux/include/dux/c/sig.h60
-rw-r--r--dux/include/dux/c/str.h47
-rw-r--r--dux/include/dux/c/thrd.h18
-rw-r--r--dux/include/dux/c/time.h (renamed from include/dux/algo)11
-rw-r--r--dux/include/dux/cxx/base.hh402
-rw-r--r--dux/include/dux/cxx/io.hh (renamed from include/dux/algo.d/abs.hh)18
-rw-r--r--dux/include/dux/cxx/math.hh141
-rw-r--r--dux/include/dux/cxx/media.hh22
-rw-r--r--dux/include/dux/cxx/mem.hh92
-rw-r--r--dux/include/dux/cxx/seq.hh47
-rw-r--r--dux/include/dux/cxx/sig.hh96
-rw-r--r--dux/include/dux/cxx/str.hh92
-rw-r--r--dux/include/dux/cxx/thrd.hh18
-rw-r--r--dux/include/dux/cxx/time.hh (renamed from src/dux/_getpthrdhandl.cc)11
-rw-r--r--dux/include/dux/io (renamed from include/dux/str)16
-rw-r--r--dux/include/dux/io.h24
-rw-r--r--dux/include/dux/math30
-rw-r--r--dux/include/dux/math.h84
-rw-r--r--dux/include/dux/media30
-rw-r--r--dux/include/dux/media.h (renamed from include/dux/io)10
-rw-r--r--dux/include/dux/mem30
-rw-r--r--dux/include/dux/mem.h27
-rw-r--r--dux/include/dux/seq30
-rw-r--r--dux/include/dux/seq.h28
-rw-r--r--dux/include/dux/sig30
-rw-r--r--dux/include/dux/sig.h218
-rw-r--r--dux/include/dux/str31
-rw-r--r--dux/include/dux/str.d/isalnum.ii (renamed from include/dux/str.d/isalpha.hh)4
-rw-r--r--dux/include/dux/str.d/isalpha.ii (renamed from include/dux/str.d/isalnum.hh)9
-rw-r--r--dux/include/dux/str.d/iscntrl.ii (renamed from include/dux/str.d/iscntrl.hh)16
-rw-r--r--dux/include/dux/str.d/isdigit.ii (renamed from include/dux/str.d/isdigit.hh)9
-rw-r--r--dux/include/dux/str.d/islower.ii (renamed from include/dux/str.d/islower.hh)9
-rw-r--r--dux/include/dux/str.d/ispunct.ii (renamed from include/dux/str.d/ispunct.hh)9
-rw-r--r--dux/include/dux/str.d/isspace.ii (renamed from include/dux/str.d/isspace.hh)11
-rw-r--r--dux/include/dux/str.d/issurro.ii (renamed from include/dux/str.d/issurro.hh)7
-rw-r--r--dux/include/dux/str.d/isupper.ii (renamed from include/dux/str.d/isupper.hh)9
-rw-r--r--dux/include/dux/str.d/isxdigit.ii (renamed from include/dux/str.d/isxdigit.hh)9
-rw-r--r--dux/include/dux/str.d/uniblk.ii (renamed from include/dux/str.d/uniblk.hh)319
-rw-r--r--dux/include/dux/str.d/uninm.ii2717
-rw-r--r--dux/include/dux/str.h18
-rw-r--r--dux/include/dux/sysinfo.h388
-rw-r--r--dux/include/dux/thrd (renamed from include/dux/thrd)16
-rw-r--r--dux/include/dux/thrd.h18
-rw-r--r--dux/include/dux/time30
-rw-r--r--dux/include/dux/time.h32
-rw-r--r--dux/src/abrt.cc38
-rw-r--r--dux/src/alloc.cc28
-rw-r--r--dux/src/errcdnm.cc24
-rw-r--r--dux/src/exit.cc71
-rw-r--r--dux/src/fndchr.cc (renamed from include/dux/io.d/dbgprint.hh)16
-rw-r--r--dux/src/free.cc30
-rw-r--r--dux/src/freernd.cc (renamed from include/dux/media)11
-rw-r--r--dux/src/getallocsz.cc26
-rw-r--r--dux/src/getenv.cc55
-rw-r--r--dux/src/getmainparam.cc24
-rw-r--r--dux/src/getnummainparams.cc24
-rw-r--r--dux/src/gettime.cc41
-rw-r--r--dux/src/mainparams.cc57
-rw-r--r--dux/src/onexit.cc55
-rw-r--r--dux/src/priv/alloc.cc40
-rw-r--r--dux/src/priv/assfail.c36
-rw-r--r--dux/src/priv/cpy.c42
-rw-r--r--dux/src/priv/curerrcd.c (renamed from include/dux/sys)11
-rw-r--r--dux/src/priv/dbglog.c (renamed from src/dux/_freepthrdhandl.cc)14
-rw-r--r--dux/src/priv/dbgunreach.c (renamed from src/dux/getenv.cc)19
-rw-r--r--dux/src/priv/dup.c39
-rw-r--r--dux/src/priv/fill.c46
-rw-r--r--dux/src/priv/free.cc (renamed from src/dux/exit.cc)18
-rw-r--r--dux/src/priv/geterrnoptr.c35
-rw-r--r--dux/src/priv/logstderr.c26
-rw-r--r--dux/src/priv/nomedia.c (renamed from include/dux/cstr)15
-rw-r--r--dux/src/priv/plot.c (renamed from include/dux/algo.d/filln.hh)22
-rw-r--r--dux/src/priv/posix/clock_gettime.c35
-rw-r--r--dux/src/priv/posix/close.c (renamed from include/dux/algo.d/renew.hh)21
-rw-r--r--dux/src/priv/posix/getpid.c35
-rw-r--r--dux/src/priv/posix/getrandom.c (renamed from src/dux/_pthrdcrt.cc)22
-rw-r--r--dux/src/priv/posix/kill.c (renamed from src/dux/_pthrdjoin.cc)25
-rw-r--r--dux/src/priv/posix/mmap.c31
-rw-r--r--dux/src/priv/posix/nanosleep.c35
-rw-r--r--dux/src/priv/posix/openat.c34
-rw-r--r--dux/src/priv/posix/sigaction.c37
-rw-r--r--dux/src/priv/posix/write.c34
-rw-r--r--dux/src/priv/start.cc65
-rw-r--r--dux/src/priv/syscall.S50
-rw-r--r--dux/src/raise.cc45
-rw-r--r--dux/src/realloc.cc36
-rw-r--r--dux/src/rnd.cc (renamed from include/dux/algo.d/cpyn.hh)24
-rw-r--r--dux/src/setsighandl.cc109
-rw-r--r--dux/src/sleep.cc54
-rw-r--r--dux/src/strcmp.cc26
-rw-r--r--dux/src/strcpy.cc26
-rw-r--r--dux/src/strdup.cc26
-rw-r--r--dux/src/streq.cc26
-rw-r--r--dux/src/strlen.cc26
-rw-r--r--dux/src/trap.cc (renamed from include/dux/algo.d/isinf.hh)25
-rw-r--r--include/dux/algo.d/cpy.hh22
-rw-r--r--include/dux/algo.d/fill.hh22
-rw-r--r--include/dux/algo.d/ins.hh22
-rw-r--r--include/dux/algo.d/insn.hh23
-rw-r--r--include/dux/algo.d/isprime.hh30
-rw-r--r--include/dux/algo.d/min.hh25
-rw-r--r--include/dux/algo.d/mv.hh22
-rw-r--r--include/dux/algo.d/mvn.hh25
-rw-r--r--include/dux/algo.d/pow.hh33
-rw-r--r--include/dux/algo.d/sqrt.hh36
-rw-r--r--include/dux/algo.hh68
-rw-r--r--include/dux/arr.d/arr.hh217
-rw-r--r--include/dux/arr.hh61
-rw-r--r--include/dux/base.d/opt.hh55
-rw-r--r--include/dux/base.d/tup.hh43
-rw-r--r--include/dux/base.hh466
-rw-r--r--include/dux/cstr.d/cstrcmp.hh35
-rw-r--r--include/dux/cstr.d/cstrcpy.hh27
-rw-r--r--include/dux/cstr.d/cstrdup.hh24
-rw-r--r--include/dux/cstr.d/cstrlen.hh29
-rw-r--r--include/dux/io.d/fmt.hh45
-rw-r--r--include/dux/io.d/fmter.hh98
-rw-r--r--include/dux/io.d/print.hh30
-rw-r--r--include/dux/io.hh44
-rw-r--r--include/dux/media.hh54
-rw-r--r--include/dux/str.d/cnv.hh105
-rw-r--r--include/dux/str.d/str.hh118
-rw-r--r--include/dux/str.d/uninm.hh2720
-rw-r--r--include/dux/str.hh81
-rw-r--r--include/dux/sys.d/_ass.hh40
-rw-r--r--include/dux/sys.d/dobj.hh65
-rw-r--r--include/dux/sys.hh98
-rw-r--r--include/dux/thrd.d/thrd.hh87
-rw-r--r--include/dux/thrd.hh47
-rw-r--r--logo/dux.svg (renamed from dux.svg)0
-rw-r--r--logo/dux_boxes.svg (renamed from dux_boxes.svg)0
-rw-r--r--logo/u8c.svg (renamed from u8c.svg)0
-rw-r--r--logo/u8c_boxes.svg (renamed from u8c_boxes.svg)0
-rw-r--r--logo/u8c_braille.svg (renamed from u8c_braille.svg)0
-rw-r--r--src/dux/_setsiginthandl.cc29
-rw-r--r--src/dux/_siginthandl.cc23
-rw-r--r--src/dux/_sigtocsig.cc92
-rw-r--r--src/dux/abrt.cc46
-rw-r--r--src/dux/endgfx.cc47
-rw-r--r--src/dux/goatmaster.cc24
-rw-r--r--src/dux/initgfx.cc64
-rw-r--r--src/dux/priv.hh58
-rw-r--r--src/dux/qexit.cc46
-rw-r--r--src/dux/raise.cc53
-rw-r--r--src/dux/sighandl.cc94
-rw-r--r--src/dux/sleep.cc49
-rw-r--r--src/dux/trap.cc31
-rw-r--r--src/dux/unreach.cc30
-rw-r--r--src/dux/win.cc144
173 files changed, 8469 insertions, 6858 deletions
diff --git a/.gitignore b/.gitignore
index 463cf97..785bf99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
-/.vscode
/build
vgcore.* \ No newline at end of file
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 0000000..2ac6f1e
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,320 @@
+| 26
+
+- Rewrite and restructure project;
+- Update readme;
+
+| 25
+
+- Merge with dux.
+- Make new logo (based on dux_boxes).
+- Merge maths facilities and sequence facilities.
+- Implement alternatives for stdlib.
+- Use new header structure
+- Make thread API cleaner.
+- Make windowing API cleaner.
+- ...
+
+TO-DO: Expand and improve the changelog for this version.
+
+| 24
+
+- Remove constructor taking a single value for `u8c::arr`.
+- Add new overload taking a single value for `u8c::arr::app`.
+- Add function `u8c::arr::log` to enable logging of array operations *(doesn't currently log a lot)*.
+- Remove `u8c::trunc`.
+- Initialise memory allocated by `u8c::arr`.
+- Add overload taking value used for memory-initialisation for `u8c::arr::alloc`.
+- Update code formatting.
+
+| 23
+
+- Rewrite for C++ *(read readme for list of current features)*.
+- Use CMake for building.
+- Update logo.
+
+| 22
+
+- Remove documentation (too hight-maintainence).
+- Rename `include/u8c/is.h` to `include/u8c/chk.h`
+- Revert u8c-9 “Remove some optimisations, as they prevent C++ compatibility.”.
+- Fix #1.
+- Use binary literals for bitwise operations.
+- Add more control characters to `u8c_iscntrl`.
+- Change type of result of the `u8c_is`* functions fromt `uint_least8_t` to `bool`.
+- Add more characters to `u8c_ispunct`.
+- Update Makefile.
+- Revert u8c-21 “Rename `u8c_unimax` to `u8c_u32max` and move it to `u8c/u32.h`.”.
+- Add function for checking if a character is a surrogate point; `u8c_issurro`.
+- Split `u8c_isalpha` into `u8c_islower` and `u8c_isupper`, move current mapping to `u8c_islower`. All characters that are neither upper case or lower case must be put in `u8c_isalpha`.
+- Add function for getting the name of an Unicode codepoint; `u8c_uninm` (has currently only mapped around ⅔% of all Unicode characters).
+- Revert accidental changes to changelog (please be more careful and observant in the future).
+- Delete `u8c_errtyp_maxerrtyp` (in favour of `u8c_errtyp_all`).
+- Switch the arguments of `u8c_seterr`.
+- Add function for getting the name of the block an Unicode codepoint is located in; `u8c_uniblk` (has currently only mapped around 39% of the Unicode blocks).
+- Rename all instances of `u32` to `str`.
+- Optimise for size (`-Os` instead of `-O3`).
+- Update Readme.
+- **MAJOR**: Return a tuple (structures) in all returning functions, otherwise void.
+- Add help screen to test program.
+- Update Gitignore.
+- Restructure test program.
+- Add more characters to `u8c_islower`.
+- Add more characters to `u8c_isupper`.
+- Remove the `runtest` target (just use `make && export LD_LIBRARY_PATH=$PWD && ./test`, which can more easily be modified to pass arguments).
+- Add more characters to `u8c_isalpha`.
+- Fix incorrect error being set (somewhere, I forgot where).
+- Fix `SIZE_C`.
+
+| 21
+
+- Update readme.
+- Require C23 (C2x).
+- Use GCC (has better C23 support).
+- Cleanup UTF-8 decoder and encoder (using binary literals).
+- Rename `u8c_unimax` to `u8c_u32max` and move it to `u8c/u32.h`.
+- Don't clear last error message on calls to `u8c_geterr`.
+- Restructure source files.
+- Fix makefile.
+- Update test program.
+
+| 20
+
+- Update documentation.
+- Optimise `u8c_println`,
+- Make `u8c_print`, `u8c_println`, and z`u8c_vprint` thread-safe (if thread-safe is not disabled).
+- Create base for UTF-16 related functions:
+ - Add function for allocating UTF-16 strings; `u8c_u16alloc`.
+ - Add function for deallocating UTF-16 strings; `u8c_u16free`.
+- Restructure headers:
+ - `u8c/SIZE_C.h`:
+ - `SIZE_C`
+ - `u8c/err.h`:
+ - `u8c_errtyp`
+ - `u8c_errhandltyp`
+ - `u8c_geterr`
+ - `u8c_regerrhandl`
+ - `u8c_seterr`
+ - `u8c/fmt`:
+ - `u8c_dbgprint`
+ - `u8c_fmt`
+ - `u8c_fmttyp`
+ - `u8c_print`
+ - `u8c_println`
+ - `u8c_setfmt`
+ - `u8c_vfmt`
+ - `u8c_vprint`
+ - `u8c/is.h`:
+ - `u8c_isalnum`
+ - `u8c_isalpha`
+ - `u8c_iscntrl`
+ - `u8c_isdigit`
+ - `u8c_ispunct`
+ - `u8c_isspace`
+ - `u8c_isxdigit`
+ - `u8c/main.h`:
+ - `u8c_dbg`
+ - `u8c_abrt`
+ - `u8c_end`
+ - `u8c_init`
+ - `u8c_thrdsafe`
+ - `u8c_unimax`
+ - `u8c_ver`
+ - `u8c/u16.h`:
+ - `u8c_u16alloc`
+ - `u8c_u16free`
+ - `u8c/u32.h`:
+ - `u8c_u32alloc`
+ - `u8c_u32cat`
+ - `u8c_u32cmp`
+ - `u8c_u32cp`
+ - `u8c_u32fndchr`
+ - `u8c_u32fndpat`
+ - `u8c_u32free`
+ - `u8c_u32ins`
+ - `u8c_u32substr`
+ - `u8c_u32sz`
+ - `u8c/u8.h`:
+ - `u8c_u8alloc`
+ - `u8c_u8dec`
+ - `u8c_u8enc`
+ - `u8c_u8free`
+- Disable *-Wpadded*.
+- Update `SIZE_C`.
+- Always use character constants (instead of numerical values).
+
+| 1↋
+
+- Add more codepoints to `u8c_ispunct`.
+- Don't use Zstandard for man page compression. Use Gzip.
+- Remove Zstandard as a dependency.
+- Update gitignore.
+
+| 1↊
+
+- Initialise error handler array.
+- Initialise and destroy error handler array mutex.
+- Fix Makefile.
+- Update gitignore.
+
+| 19
+
+- Fix error when compiling with GCC: *src/u8c/dat.c:22:29: error: initializer element is not constant [-Wpedantic]*.
+- Improve error handling:
+ - Add enumeration type for error types; `u8c_errtyp`.
+ - Add function for registering error handlers; `u8c_regerrhandl` (see `test.c`).
+- Add function for inserting UTF-32 strings into UTF-32 strings; `u8c_u32ins`.
+- Enable more warnings.
+- Add man pages.
+- Fix `u8c_u32cat` skipping the last character in `lstr`.
+- Remove the `uninstall` target (it was deemed to unsafe).
+- Add *Zstandard* as a dependency.
+
+| 18
+
+- Update `.gitignore`.
+- Remove core dump.
+
+| 17
+
+- Create new logo.
+- Update headers.
+- Invert status values.
+
+| 16
+
+- Add function for concatenating UTF-32 strings; `u8c_u32cat`.
+- Add functions for allocating UTF-32 and UTF-8 strings; `u8c_u32alloc` and `u8c_u8alloc`.
+- Add function for finding a given codepoint in an UTF-32 string; `u8c_u32fndchr`.
+- Add function for finding a given pattern (string) in an UTF-32 string; `u8c_u32fndpat`.
+- Update `SIZE_C`.
+- Add function for aborting; `u8c_abrt`.
+- Rename `u8c_debug` to `u8c_dbg`.
+- Use `bool` (`_Bool`) for return values instead of `uint_least8_t`.
+- Add more format types.
+- Fix incorrect unabbreviated names in headers.
+- Add another function from `ctypes.h`; `u8c_isxdigit`.
+- Use `char32_t` (from `uchar.h`) instead of `uint_least32_t` in UTF-32.
+- Use `unsigned char` instead of `uint_least8_t` in UTF-8.
+- Move all data into `u8c_dat` (of type `struct u8c_dattyp`).
+- Add function for setting the format (base and endian) of `u8c_fmt` and company; `u8c_setfmt`.
+- Remove `u8c_txt` in favour of Unicode string literals (much clearer code, but less portable).
+- Add function for getting a sub-string of an UTF-32 string; `u8c_u32substr`.
+- Don't count the null-terminator in string sizes.
+- Add macro for maximum valid Unicode codepoint; `u8c_unimax`.
+- Remove `txttolit`.
+- Add function for deallocating UTF-8 strings; `u8c_u8free`.
+- Turn both `u8c_dbg` and `u8c_thrdsafe` into type `bool` from `uint_least8_t`.
+- Add more letters to `u8c_isalpha`.
+
+| 15
+
+- Add missing include directives to `include/u8c/u32free.h` and `include/u8c/u8free.h`.
+
+| 14
+
+- Free error message when `u8c_geterr` is called (after copying, of course).
+- Update `u8c_freeu8`.
+- Rename `u8c_freeu32` to and `u8c_u32free` and `u8c_freeu8` to `u8c_u8free`.
+
+| 13
+
+- Fix `u8c_txt` in C++.
+
+| 12
+
+- Use `u8c_println` instead of `u8c_print` in `u8c_dbgprint`.
+
+| 11
+
+- Update README.
+- Update Makefile.
+- Use constant variables more.
+- Create macro for creating human-readable UTF-32 strings; `u8c_txt`.
+- Add macros for deallocating UTF-32 and UTF-8 strings (use these instead of `free` or `std::free`); `u8c_u32free` and `u8c_u8free`.
+- Optimisations.
+
+| 10
+
+- Make `u8c_seterr` public.
+- Update logo.
+
+| ↋
+
+- Fix `u8c_ver`.
+- Add Turkish letters to `u8c_isalpha`.
+
+| ↊
+
+- Add UTF-32 alternatives to some of the functions from `ctypes.h`; `u8c_isalnum`, `u8c_isalpha`, `u8c_iscntrl`, `u8c_isdigit`, `u8c_isspace`, and `u8c_ispunct`.
+- Add assertions.
+- Create new logo (move old logo to `u8c_old.svg`).
+
+| 9
+
+- Optimisations.
+- Remove some optimisations, as they prevent C++ compatibility.
+- Fix memory leak in test program.
+- Add function for comparing UTF-32 strings; `u8c_u32cmp`.
+
+| 8
+
+- Optimisations.
+
+| 7
+
+- Optimisations.
+
+| 6
+
+- Remove unneeded include directives.
+- Update `SIZE_C` to utilise the C++23 `std::size_t` literal suffix (`uz`).
+- Fix include guard in `include/u8c/stat.h`.
+- Add more error messages.
+
+| 5
+
+- Add logo (`u8c.svg`).
+- Fix UTF-8 decoder.
+- Update README.
+
+| 4
+
+- Add link to PKGBUILD in README.
+
+| 3
+
+- Remove `include/u8c.h`.
+- Fix minor errors.
+
+| 2
+
+- Move PKGBUILD to seperate project.
+- Create a *master* header that includes every other header.
+- Create `size_t` constant macro.
+- Add colour to text formatting.
+- Specify what file to print to in `u8c_print`.
+- Add C++ compatibility to headers.
+- Add functions for initialising and ending *u8c*.
+- Add dedicated function for text formatting (altough not working at the moment); `u8c_fmt`.
+- Remove `u8c_free`.
+- Improve error handling in the form of error messages (which can be retrieved by the programmer via `u8c_geterr`).
+- Split `u8c_print` into two functions: `u8c_print` and `u8c_println`.
+- Break the UTF-8 decoder somehow.
+- Add compile-time option to be thread-safe (requiring C11 threads if enabled).
+- Add function for copying UTF-32; `u8c_u32cp`.
+- Add function for getting the size of an UTF-32 array; `u8c_u32sz`.
+- Add `va_list` alternatives to `u8c_fmt` and `u8c_print`; `u8c_vfmt` and `u8c_vprint`.
+- Add test-program (run via `make runtest`).
+- Add program to make human-readable UTF-32 strings machine-readable.
+- Turn `u8c_ver` into a compile-time macro.
+- Enable more warnings when compiling.
+- Add assertions.
+
+| 1
+
+- Fix Makefile compiling *u8c.so* instead of *libu8c.so*.
+- Add global variable for version control.
+
+| 0
+
+- Fork from *luma*.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 794bb0c..afad967 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,299 +1,27 @@
cmake_minimum_required(
VERSION
- 3.20
+ 3.19
)
+
+# Project:
project(
dux
- VERSION
- 29
- DESCRIPTION
- "General purpose library."
- HOMEPAGE_URL
- "https://mandelbrot.dk/delta/dux"
- LANGUAGES
- CXX
-)
-set(
- CMAKE_CXX_STANDARD
- 23
-)
-
-# Options:
-option(
- DUX_ENABLE_DEMO
- "Build the demo program."
-)
-option(
- DUX_ENABLE_SYS
- "Enable the system extensions."
-)
-option(
- DUX_GFXPROTO
- "Set the graphics protocol: \"windx\" (WinAPI/DirectX), \"wlgl\" (Wayland/OpenGL), \"wlvk\" (Wayland/Vulkan), \"xgl\" (X/OpenGL), \"xvk\" (X/Vulkan)"
-)
-option(
- DUX_SFXPROTO
- "Set the sound protocol: \"dx\" (DirectX), \"pa\" (PulseAudio), \"pw\" (PipeWire)"
-)
-
-# Disable in-souce builds:
-if(
- "${PROJECT_BINARY_DIR}"
- STREQUAL
- "${PROJECT_SOURCE_DIR}"
-)
- message(
- FATAL_ERROR
- "In-source building is not allowed."
- )
-endif()
-
-# Compiler Settings:
-message(
- STATUS
- "Enabling colour output for Clang or GCC..."
-)
-if(
- "${CMAKE_CXX_COMPILER_ID}"
- STREQUAL
- "Clang"
-)
- add_compile_options(
- "-fcolor-diagnostics"
- )
-elseif(
- "${CMAKE_CXX_COMPILER_ID}"
- STREQUAL
- "GNU"
-)
- add_compile_options (
- "-fdiagnostics-color=always"
- )
-endif()
-message(
- STATUS
- "Enabling compile warnings..."
-)
-if(
- MSVC
-)
- add_compile_options(
- "/W4"
- "/WX"
- )
-else()
- add_compile_options(
- "-pedantic-errors"
- "-Wfatal-errors"
- "-Wall"
- "-Wconversion"
- "-Werror"
- "-Wextra"
- "-Wunreachable-code"
- "-Wunused"
- )
- if(
- "${CMAKE_CXX_COMPILER_ID}"
- STREQUAL
- "Clang"
- )
- add_compile_options(
- "-Wnewline-eof"
- )
- endif()
-endif()
-if(
- CMAKE_BUILD_TYPE
- MATCHES
- Release
)
- message(
- STATUS
- "Setting optimisation level..."
- )
- if(
- MSVC
- )
- add_compile_options(
- "/Os"
- )
- else()
- add_compile_options(
- "-Os"
- )
- endif()
-endif()
-# Include directories:
-include_directories(
- "${PROJECT_SOURCE_DIR}/include"
+# Constants:
+set(
+ DUX_VERSION
+ 30.0
)
-# dux settings:
-add_library(
- dux
- SHARED
- "src/dux/_setsiginthandl.cc"
- "src/dux/_siginthandl.cc"
- "src/dux/_sigtocsig.cc"
- "src/dux/abrt.cc"
- "src/dux/endgfx.cc"
- "src/dux/exit.cc"
- "src/dux/getenv.cc"
- "src/dux/goatmaster.cc"
- "src/dux/initgfx.cc"
- "src/dux/qexit.cc"
- "src/dux/raise.cc"
- "src/dux/sighandl.cc"
- "src/dux/sleep.cc"
- "src/dux/trap.cc"
- "src/dux/unreach.cc"
- "src/dux/win.cc"
-)
-if(
- UNIX
-)
- set_property(
- TARGET
- dux
- APPEND
- PROPERTY
- SOURCES
- "src/dux/_freepthrdhandl.cc"
- "src/dux/_getpthrdhandl.cc"
- "src/dux/_pthrdcrt.cc"
- "src/dux/_pthrdjoin.cc"
- )
-endif()
-target_compile_definitions(
- dux
- PRIVATE
- _XOPEN_SOURCE=700
-)
-if(
- DUX_GFXPROTO
- STREQUAL
- "wlgl"
-)
- message(
- STATUS
- "Using Wayland/OpenGL for graphics."
- )
- target_compile_definitions(
- dux
- PRIVATE
- dux_gfxproto_wlgl
- )
-elseif(
- DUX_GFXPROTO
- STREQUAL
- "wlvk"
-)
- message(
- STATUS
- "Using Wayland/Vulkan for graphics."
- )
- target_compile_definitions(
- dux
- PRIVATE
- dux_gfxproto_wlvk
- )
-elseif(
- DUX_GFXPROTO
- STREQUAL
- "xgl"
-)
- message(
- STATUS
- "Using X/OpenGL for graphics."
- )
- target_compile_definitions(
- dux
- PRIVATE
- dux_gfxproto_xgl
- )
-elseif(
- DUX_GFXPROTO
- STREQUAL
- "xvk"
+# Subdirectories
+add_subdirectory(
+ "dux"
)
- message(
- STATUS
- "Using X/Vulkan for graphics."
- )
- target_compile_definitions(
- dux
- PRIVATE
- dux_gfxproto_xvk
- )
-else()
- message(
- FATAL_ERROR
- "Graphics system undefined (or invalid)! Set option \"DUX_GFXPROTO\" to: \"wlgl\" (Wayland/OpenGL), \"wlvk\" (Wayland/Vulkan), \"xgl\" (X/OpenGL), or \"xvk\" (X/Vulkan)!"
- )
-endif()
-if(
- DUX_GFXPROTO
- STREQUAL
- "wlgl"
- OR
- DUX_GFXPROTO
- STREQUAL
- "wlvk"
-)
- target_link_libraries(
- dux
- wayland-client
- )
-elseif(
- DUX_GFXPROTO
- STREQUAL
- "xgl"
- OR
- DUX_GFXPROTO
- STREQUAL
- "xvk"
-)
- target_link_libraries(
- dux
- xcb
- )
- if(
- DUX_GFXPROTO
- STREQUAL
- "xgl"
- )
- target_link_libraries(
- dux
- X11-xcb
- )
- endif()
-endif()
-if(
- NOT
- WIN32
-)
- target_link_libraries(
- dux
- dl
- pthread
- )
-endif()
-
-# Demo settings:
if(
DUX_ENABLE_DEMO
)
- add_executable(
- demo
- "dux-demo/main.cc"
- )
- add_dependencies(
- demo
- dux
- )
- target_link_libraries(
- demo
- dux
+ add_subdirectory(
+ "dux-demo"
)
endif()
diff --git a/README.html b/README.html
new file mode 100644
index 0000000..a8afe7c
--- /dev/null
+++ b/README.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <h1>dux</h1>
+ <h3><a href="https://discord.gg/UshkEdZPdM">Discord Server</a></h3>
+ <p><i><a href="https://mandelbrot.dk/dux">dux</a></i> is a free, open-source, and semi-portable general-purpose library for the C and C++ programming languages.</p>
+ <p>The main purpose of dux is to implement a clean, morden and featureful library.</p>
+ <o>Our primary goal is to implement this almost completely ourselves and with as few dependencies as possible. Therefore, dux may not be (and is currently not) as portable as many other libraries, with the currently supported platforms being:</p>
+ <ul>
+ <li>
+ <p>Aarch64, FreeBSD</p>
+ </li>
+ <li>
+ <p><i>Aarch64, Linux (Previously tested but currently untested)</i></p>
+ </li>
+ <li>
+ <p><i>AMD64, FreeBSD (Untested)</i></p>
+ </li>
+ <li>
+ <p>AMD64, Linux</p>
+ </li>
+ </ul>
+ <h2>Compiling</h2>
+ <p>This project uses CMake as it's build system. The option <code>DUX_ENABLE_DEMO</code> (<code>FALSE</code>|<code>TRUE</code>) enables compilation of the demo program (<code>dux-demo</code>).</p>
+ <h2>Contributing</h2>
+ <p>You may submit bug reports or suggestions on our <a href="https://discord.gg/UshkEdZPdM">Discord Server</a> in the #bug-reports and #suggestions channels respectively..</p>
+ <p>dux does currently not accept <i>any</i> merge requests.</p>
+ <h2>Copyright &amp; License</h2>
+ <p>Copyright 2021, 2022 Gabriel Jensen.</p>
+ <p>This file is part of <i>dux</i>.</p>
+ <p><i>dux</i> 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.</p>
+ <p><i>dux</i> 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.</p>
+ <p>You should have received a copy of the GNU Affero General Public License along with <i>dux</i>. If not, see <a href="https://www.gnu.org/licenses">https://www.gnu.org/licenses</a>.</p>
+</html>
diff --git a/README.md b/README.md
deleted file mode 100644
index 3b9ee8b..0000000
--- a/README.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# dux
-
-[*dux*](https://mandelbrot.dk/delta/dux) is a free, open-source and portable general-purpose library for the C++ programming language.
-
-It is intended as a modular, morden and stable replacement for the C++ standard library and other major libraries *(such as Boost)*. In the *features* section a list of fascilities included in this library is available.
-
-## Genesis
-
-*note: This section is outdated.*
-
-dux started out in 2019 as a small, useless library under the name *duckGFX*. This library was capable of two things: opening windows, followed by closing them, both achieved using an Xlib back-end.
-
-Progress stagnated following. The project was renamed to *duckFX*, and later to *dfx*, but during this time almost no development occured.
-
-In March of 2020, dfx saw a significant rework. The library was renamed yet again, this time to *duX*. XLib was dropped in favour of XCB *(where possible)*, and Wayland support was planned, but didn't become of much.
-
-In early April of 2020, duX was no longer a single-header header-only library. As a result of this, a build-system was logical, and so CMake was chosen. At the same time, support for Wayland was completely dropped.
-
-In late April and early May of 2020, Wayland support slowly crawled back. macOS support was considered, but also very quickly dropped, as I had no way to debug it.
-
-Later the same year, in an attempt of rebranding, the project was renamed to *duxXYZ*. It was actually planned to become a 3D-graphics engine, but development halted quickly. The project remained silent for almost a year from here, before any serious progress was made at least.
-
-When the [*luma*](https://mandelbrot.dk/delta/luma) programming-language was started in the early 2021, duxXYZ was decided to become a part of the standard-library. Some development was made, but the adoption was ultimately repealed.
-
-In the end of May of 2021, following the creation of the [*dux*](https://mandelbrot.dk/delta/dux) library, development returned again. All code from *duxXYZ* was rewritten from C++ to C, as the latter was my programming language of choice. The project as a whole was for the last time renamed, this time to *dux*. Contrary to what I once slated, Cocoa (replacing Quartz) and WinAPI was formally planned, however without a static date. An extension to this was the disposition that dux would also provide an interface for graphics rendering, with DirectX, Metal, OpenGL, and Vulkan back-ends all being planned, still without a static date. Wayland was also a top-priority.
-
-In the beginning of this same month of May, *u8c* – a library for encoding and decoding UTF-8 messages in the C programming language – was started. This project evolved a lot, later offering replacemnts for the character classifications fascilities in the C standard library with support for Unicode characters.
-
-After a few months, u8c was rewritten in C++. This new edition also offered compile-time *(constexpr)* replacements for some of the members of the C standard library, including the maths library and the string manipulation library.
-
-As a reaction to the massive bloat of some C++ standard library implementations, u8c also had replacements for a lot of the C++ standard template library.
-
-In October of 2021, progress on dux resumed. This was partly thanks to the maturity of u8c, as it [u8c] could now be used in other projects. Support for multithreading also started at this time.
-
-In the same month, dux and u8c underwent a merge. This was planned for some time, but was not executed, as u8c was supposed to be as portable as possible. dux was not as portable. To combat this, the new merged library was made modular. End-users could specify what modules to be build, allowing for the same level of portability.
-
-## Features
-
-TBA
-
-## Examples
-
-TBA
-
-## Installing
-
-TBA
-
-## Compiling
-
-dux has been tested to work with Clang 14. A compiler conforming to the C++2b standard is required.
-
-You may also directly install the header files (in `/include`) in case your system is not supported or you do not need the extra facilities.
-
-1. Checkout dux using `git`:
-
- * Clone the repository: `git clone https://mandelbrot.dk/delta/dux.git`
- * Or do a shallow cone: `git clone --depth 1 https://mandelbrot.dk/delta/dux.git`
-
-2. Configure the compilation of dux:
-
- * `cd dux`
- * `cmake -B build`
-
- You can append the following options to the command:
-
- * `-DCMAKE_BUILD_TYPE` — Set the build type. Can be either `Debug`or `Release`.
-
-3. Build dux build
-
- * `cmake --build build`
-
-## Contributing
-
-dux does currently not accept **any** merge requests.
-
-## Copyright & License
-
-Copyright 2021 Gabriel Jensen
-
-This file is part of dux.
-
-dux 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.
-
-dux 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 dux. If not, see <https://www.gnu.org/licenses/>. \ No newline at end of file
diff --git a/changelog.md b/changelog.md
deleted file mode 100644
index 4f2de28..0000000
--- a/changelog.md
+++ /dev/null
@@ -1,315 +0,0 @@
-# 25
-
-* Merge with dux.
-* Make new logo (based on dux_boxes).
-* Merge maths facilities and sequence facilities.
-* Implement alternatives for stdlib.
-* Use new header structure
-* Make thread API cleaner.
-* Make windowing API cleaner.
-* ...
-
-**TO-DO: Expand and improve the changelog for this version.**
-
-# 24
-
-* Remove constructor taking a single value for `u8c::arr`.
-* Add new overload taking a single value for `u8c::arr::app`.
-* Add function `u8c::arr::log` to enable logging of array operations *(doesn't currently log a lot)*.
-* Remove `u8c::trunc`.
-* Initialise memory allocated by `u8c::arr`.
-* Add overload taking value used for memory-initialisation for `u8c::arr::alloc`.
-* Update code formatting.
-
-# 23
-
-* Rewrite for C++ *(read readme for list of current features)*.
-* Use CMake for building.
-* Update logo.
-
-# 22
-
-* Remove documentation (too hight-maintainence).
-* Rename `include/u8c/is.h` to `include/u8c/chk.h`
-* Revert u8c-9 “Remove some optimisations, as they prevent C++ compatibility.”.
-* Fix #1.
-* Use binary literals for bitwise operations.
-* Add more control characters to `u8c_iscntrl`.
-* Change type of result of the `u8c_is`* functions fromt `uint_least8_t` to `bool`.
-* Add more characters to `u8c_ispunct`.
-* Update Makefile.
-* Revert u8c-21 “Rename `u8c_unimax` to `u8c_u32max` and move it to `u8c/u32.h`.”.
-* Add function for checking if a character is a surrogate point; `u8c_issurro`.
-* Split `u8c_isalpha` into `u8c_islower` and `u8c_isupper`, move current mapping to `u8c_islower`. All characters that are neither upper case or lower case must be put in `u8c_isalpha`.
-* Add function for getting the name of an Unicode codepoint; `u8c_uninm` (has currently only mapped around ⅔% of all Unicode characters).
-* Revert accidental changes to changelog (please be more careful and observant in the future).
-* Delete `u8c_errtyp_maxerrtyp` (in favour of `u8c_errtyp_all`).
-* Switch the arguments of `u8c_seterr`.
-* Add function for getting the name of the block an Unicode codepoint is located in; `u8c_uniblk` (has currently only mapped around 39% of the Unicode blocks).
-* Rename all instances of `u32` to `str`.
-* Optimise for size (`-Os` instead of `-O3`).
-* Update Readme.
-* **MAJOR**: Return a tuple (structures) in all returning functions, otherwise void.
-* Add help screen to test program.
-* Update Gitignore.
-* Restructure test program.
-* Add more characters to `u8c_islower`.
-* Add more characters to `u8c_isupper`.
-* Remove the `runtest` target (just use `make && export LD_LIBRARY_PATH=$PWD && ./test`, which can more easily be modified to pass arguments).
-* Add more characters to `u8c_isalpha`.
-* Fix incorrect error being set (somewhere, I forgot where).
-* Fix `SIZE_C`.
-
-# 21
-
-* Update readme.
-* Require C23 (C2x).
-* Use GCC (has better C23 support).
-* Cleanup UTF-8 decoder and encoder (using binary literals).
-* Rename `u8c_unimax` to `u8c_u32max` and move it to `u8c/u32.h`.
-* Don't clear last error message on calls to `u8c_geterr`.
-* Restructure source files.
-* Fix makefile.
-* Update test program.
-
-# 20
-
-* Update documentation.
-* Optimise `u8c_println`,
-* Make `u8c_print`, `u8c_println`, and `u8c_vprint` thread-safe (if thread-safe is not disabled).
-* Create base for UTF-16 related functions:
- * Add function for allocating UTF-16 strings; `u8c_u16alloc`.
- * Add function for deallocating UTF-16 strings; `u8c_u16free`.
-* Restructure headers:
- * `u8c/SIZE_C.h`:
- * `SIZE_C`
- * `u8c/err.h`:
- * `u8c_errtyp`
- * `u8c_errhandltyp`
- * `u8c_geterr`
- * `u8c_regerrhandl`
- * `u8c_seterr`
- * `u8c/fmt`:
- * `u8c_dbgprint`
- * `u8c_fmt`
- * `u8c_fmttyp`
- * `u8c_print`
- * `u8c_println`
- * `u8c_setfmt`
- * `u8c_vfmt`
- * `u8c_vprint`
- * `u8c/is.h`:
- * `u8c_isalnum`
- * `u8c_isalpha`
- * `u8c_iscntrl`
- * `u8c_isdigit`
- * `u8c_ispunct`
- * `u8c_isspace`
- * `u8c_isxdigit`
- * `u8c/main.h`:
- * `u8c_dbg`
- * `u8c_abrt`
- * `u8c_end`
- * `u8c_init`
- * `u8c_thrdsafe`
- * `u8c_unimax`
- * `u8c_ver`
- * `u8c/u16.h`:
- * `u8c_u16alloc`
- * `u8c_u16free`
- * `u8c/u32.h`:
- * `u8c_u32alloc`
- * `u8c_u32cat`
- * `u8c_u32cmp`
- * `u8c_u32cp`
- * `u8c_u32fndchr`
- * `u8c_u32fndpat`
- * `u8c_u32free`
- * `u8c_u32ins`
- * `u8c_u32substr`
- * `u8c_u32sz`
- * `u8c/u8.h`:
- * `u8c_u8alloc`
- * `u8c_u8dec`
- * `u8c_u8enc`
- * `u8c_u8free`
-* Disable *-Wpadded*.
-* Update `SIZE_C`.
-* Always use character constants (instead of numerical values).
-
-# 1↋
-
-* Add more codepoints to `u8c_ispunct`.
-* Don't use Zstandard for man page compression. Use Gzip.
-* Remove Zstandard as a dependency.
-* Update gitignore.
-
-# 1↊
-
-* Initialise error handler array.
-* Initialise and destroy error handler array mutex.
-* Fix Makefile.
-* Update gitignore.
-
-# 19
-
-* Fix error when compiling with GCC: *src/u8c/dat.c:22:29: error: initializer element is not constant [-Wpedantic]*.
-* Improve error handling:
- * Add enumeration type for error types; `u8c_errtyp`.
- * Add function for registering error handlers; `u8c_regerrhandl` (see `test.c`).
-* Add function for inserting UTF-32 strings into UTF-32 strings; `u8c_u32ins`.
-* Enable more warnings.
-* Add man pages.
-* Fix `u8c_u32cat` skipping the last character in `lstr`.
-* Remove the `uninstall` target (it was deemed to unsafe).
-* Add *Zstandard* as a dependency.
-
-# 18
-
-* Update `.gitignore`.
-* Remove core dump.
-
-# 17
-
-* Create new logo.
-* Update headers.
-* Invert status values.
-
-# 16
-
-* Add function for concatenating UTF-32 strings; `u8c_u32cat`.
-* Add functions for allocating UTF-32 and UTF-8 strings; `u8c_u32alloc` and `u8c_u8alloc`.
-* Add function for finding a given codepoint in an UTF-32 string; `u8c_u32fndchr`.
-* Add function for finding a given pattern (string) in an UTF-32 string; `u8c_u32fndpat`.
-* Update `SIZE_C`.
-* Add function for aborting; `u8c_abrt`.
-* Rename `u8c_debug` to `u8c_dbg`.
-* Use `bool` (`_Bool`) for return values instead of `uint_least8_t`.
-* Add more format types.
-* Fix incorrect unabbreviated names in headers.
-* Add another function from `ctypes.h`; `u8c_isxdigit`.
-* Use `char32_t` (from `uchar.h`) instead of `uint_least32_t` in UTF-32.
-* Use `unsigned char` instead of `uint_least8_t` in UTF-8.
-* Move all data into `u8c_dat` (of type `struct u8c_dattyp`).
-* Add function for setting the format (base and endian) of `u8c_fmt` and company; `u8c_setfmt`.
-* Remove `u8c_txt` in favour of Unicode string literals (much clearer code, but less portable).
-* Add function for getting a sub-string of an UTF-32 string; `u8c_u32substr`.
-* Don't count the null-terminator in string sizes.
-* Add macro for maximum valid Unicode codepoint; `u8c_unimax`.
-* Remove `txttolit`.
-* Add function for deallocating UTF-8 strings; `u8c_u8free`.
-* Turn both `u8c_dbg` and `u8c_thrdsafe` into type `bool` from `uint_least8_t`.
-* Add more letters to `u8c_isalpha`.
-
-# 15
-
-* Add missing include directives to `include/u8c/u32free.h` and `include/u8c/u8free.h`.
-
-# 14
-
-* Free error message when `u8c_geterr` is called (after copying, of course).
-* Update `u8c_freeu8`.
-* Rename `u8c_freeu32` to and `u8c_u32free` and `u8c_freeu8` to `u8c_u8free`.
-
-# 13
-
-* Fix `u8c_txt` in C++.
-
-# 12
-
-* Use `u8c_println` instead of `u8c_print` in `u8c_dbgprint`.
-
-# 11
-
-* Update README.
-* Update Makefile.
-* Use constant variables more.
-* Create macro for creating human-readable UTF-32 strings; `u8c_txt`.
-* Add macros for deallocating UTF-32 and UTF-8 strings (use these instead of `free` or `std::free`); `u8c_u32free` and `u8c_u8free`.
-* Optimisations.
-
-# 10
-
-* Make `u8c_seterr` public.
-* Update logo.
-
-# ↋
-
-* Fix `u8c_ver`.
-* Add Turkish letters to `u8c_isalpha`.
-
-# ↊
-
-* Add UTF-32 alternatives to some of the functions from `ctypes.h`; `u8c_isalnum`, `u8c_isalpha`, `u8c_iscntrl`, `u8c_isdigit`, `u8c_isspace`, and `u8c_ispunct`.
-* Add assertions.
-* Create new logo (move old logo to `u8c_old.svg`).
-
-# 9
-
-* Optimisations.
-* Remove some optimisations, as they prevent C++ compatibility.
-* Fix memory leak in test program.
-* Add function for comparing UTF-32 strings; `u8c_u32cmp`.
-
-# 8
-
-* Optimisations.
-
-# 7
-
-* Optimisations.
-
-# 6
-
-* Remove unneeded include directives.
-* Update `SIZE_C` to utilise the C++23 `std::size_t` literal suffix (`uz`).
-* Fix include guard in `include/u8c/stat.h`.
-* Add more error messages.
-
-# 5
-
-* Add logo (`u8c.svg`).
-* Fix UTF-8 decoder.
-* Update README.
-
-# 4
-
-* Add link to PKGBUILD in README.
-
-# 3
-
-* Remove `include/u8c.h`.
-* Fix minor errors.
-
-# 2
-
-* Move PKGBUILD to seperate project.
-* Create a *master* header that includes every other header.
-* Create `size_t` constant macro.
-* Add colour to text formatting.
-* Specify what file to print to in `u8c_print`.
-* Add C++ compatibility to headers.
-* Add functions for initialising and ending *u8c*.
-* Add dedicated function for text formatting (altough not working at the moment); `u8c_fmt`.
-* Remove `u8c_free`.
-* Improve error handling in the form of error messages (which can be retrieved by the programmer via `u8c_geterr`).
-* Split `u8c_print` into two functions: `u8c_print` and `u8c_println`.
-* Break the UTF-8 decoder somehow.
-* Add compile-time option to be thread-safe (requiring C11 threads if enabled).
-* Add function for copying UTF-32; `u8c_u32cp`.
-* Add function for getting the size of an UTF-32 array; `u8c_u32sz`.
-* Add `va_list` alternatives to `u8c_fmt` and `u8c_print`; `u8c_vfmt` and `u8c_vprint`.
-* Add test-program (run via `make runtest`).
-* Add program to make human-readable UTF-32 strings machine-readable.
-* Turn `u8c_ver` into a compile-time macro.
-* Enable more warnings when compiling.
-* Add assertions.
-
-# 1
-
-* Fix Makefile compiling *u8c.so* instead of *libu8c.so*.
-* Add global variable for version control.
-
-# 0
-
-* Fork from *luma*.
diff --git a/dux-demo/CMakeLists.txt b/dux-demo/CMakeLists.txt
new file mode 100644
index 0000000..7c799d8
--- /dev/null
+++ b/dux-demo/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(
+ VERSION
+ 3.19
+)
+
+# Language Standards:
+set(
+ CMAKE_C_STANDARD
+ 11
+)
+set(
+ CMAKE_C_STANDARD_REQUIRED
+ TRUE
+)
+set(
+ CMAKE_CXX_STANDARD
+ 20
+)
+set(
+ CMAKE_CXX_STANDARD_REQUIRED
+ TRUE
+)
+
+# Project:
+project(
+ dux-demo
+ LANGUAGES
+ C
+ CXX
+ VERSION
+ ${DUX_VERSION}
+)
+
+# Target:
+add_executable(
+ dux-demo
+ "ctest.c"
+ "main.cc"
+)
+
+# Dependencies:
+target_link_libraries(
+ dux-demo
+ dux
+) \ No newline at end of file
diff --git a/dux-demo/ctest.c b/dux-demo/ctest.c
new file mode 100644
index 0000000..8869c00
--- /dev/null
+++ b/dux-demo/ctest.c
@@ -0,0 +1,46 @@
+# include <dux/io>
+# include <dux/math>
+# include <dux/media>
+# include <dux/mem>
+# include <dux/seq>
+# include <dux/sig>
+# include <dux/str>
+# include <dux/thrd>
+# include <dux/time>
+
+#include <stdio.h>
+
+bool dux_local_gotsig = false;
+
+static bool dux_local_sighandl(enum dux_sig const _sig) {
+ dux_ass("",_sig == dux_sig_intr);
+ dux_local_gotsig = true;
+ return false;
+}
+
+void ctest(void const * const restrict _params) {
+ dux_dbglog("dux :: demo :: Performing C-tests!\n");
+ if (dux_getnummainparams(_params) == dux_uwrdl(0x0)) {dux_dbglog("dux :: demo :: No parameters!\n");}
+ else {for (dux_uwrd n = dux_uwrdl(0x0);n < dux_getnummainparams(_params);++n) {dux_dbglog("dux :: demo :: Parameter %zu: %s\n",n + dux_uwrdl(0x1),dux_getmainparam(_params,n));}}
+ {
+ dux_setsighandl(dux_sig_intr,dux_local_sighandl);
+ dux_raise(dux_sig_intr);
+ dux_setsighandl(dux_sig_intr,dux_dflsighandl);
+ dux_ass("",dux_local_gotsig);
+ }
+ /*{
+ int arr0[] = {
+ 0xF,
+ 0xFF,
+ 0xFFF,
+ 0xFFFF,
+ };
+ int * const restrict arr1 = dux_alloc(sizeof (arr0));
+ dux_cpy(arr0,sizeof (arr0),arr1,sizeof (arr0[dux_uwrdl(0x0)]));
+ dux_ass("",arr1[dux_uwrdl(0x0)] == 0xF);
+ dux_ass("",arr1[dux_uwrdl(0x1)] == 0xFF);
+ dux_ass("",arr1[dux_uwrdl(0x2)] == 0xFFF);
+ dux_ass("",arr1[dux_uwrdl(0x3)] == 0xFFFF);
+ dux_free(arr1);
+ }*/
+}
diff --git a/dux-demo/main.cc b/dux-demo/main.cc
index fea721e..c67d5de 100644
--- a/dux-demo/main.cc
+++ b/dux-demo/main.cc
@@ -1,40 +1,219 @@
-#include <dux/io>
-#include <dux/media>
-#include <dux/thrd>
-
-auto thrdfn0(int const _x,int const _y,int const _z,int const _w) -> int {
- return _x * _y * _z * _w;
-};
-auto thrdfn1(int const _x) -> int {
- return _x * _x * _x;
-};
-
-auto main() -> int {
- _Pragma("GCC diagnostic ignored \"-Wunreachable-code\"");
- ::dux::dobj dobj;
- dobj.link("libdux.so");
- dobj.call<void>("goatmaster",0xC);
- ::dux::thrd thrd;
- auto val{thrd(thrdfn0,0xC,0xC,0xC,0xC)};
- thrd.join(&val);
- ::dux::print(U"Returned value: $\n",val);
- val = thrd(thrdfn1,0x4);
- thrd.join(&val);
- ::dux::print(U"Returned value: $\n",val);
- ::dux::initgfx();
- auto win = ::dux::win::crt("dux demo",::dux::uint32v(0x400),::dux::uint32v(0x300));
- for (auto run{true};run;) {
- while (auto const evt = win.pollevt()) {
- switch (evt->typ) {
- default:
- goto skipevt;
- case ::dux::evttyp::quit:
- run = false;
- break;
+# include <dux/arr>
+# include <dux/io>
+# include <dux/math>
+# include <dux/media>
+# include <dux/mem>
+# include <dux/seq>
+# include <dux/sig>
+# include <dux/str>
+# include <dux/thrd>
+# include <dux/time>
+
+# include <signal.h>
+
+static_assert(sizeof (::dux::uwrd) >= sizeof (void *),"::dux::uwrd must be capable of holding a pointer value");
+
+static_assert(::dux::abs(0x10) == 0x10);
+static_assert(::dux::abs(-0x10) == 0x10);
+
+static_assert(::dux::fac(0x1) == 0x1);
+static_assert(::dux::fac(0x2) == 0x2);
+static_assert(::dux::fac(0x3) == 0x6);
+static_assert(::dux::fac(0x4) == 0x18);
+
+static_assert(::dux::msb(0b1) == 0b1);
+static_assert(::dux::msb(0b10) == 0b10);
+static_assert(::dux::msb(0b101) == 0b100);
+static_assert(::dux::msb(0b1010) == 0b1000);
+static_assert(::dux::msb(0b10101) == 0b10000);
+static_assert(::dux::msb(0b101010) == 0b100000);
+
+namespace dux::local {
+ static auto gotsig {false};
+}
+
+static_assert([] {
+ auto chk {[] (::dux::sig const _sig0,int const _sig1) {
+ return static_cast<int>(_sig0) == _sig1;
+ }};
+ static_assert(chk(::dux::sig::abrt, SIGABRT));
+ static_assert(chk(::dux::sig::alrm, SIGALRM));
+ static_assert(chk(::dux::sig::bus, SIGBUS));
+ static_assert(chk(::dux::sig::chld, SIGCHLD));
+ static_assert(chk(::dux::sig::cont, SIGCONT));
+ static_assert(chk(::dux::sig::fpe, SIGFPE));
+ static_assert(chk(::dux::sig::hup, SIGHUP));
+ static_assert(chk(::dux::sig::ill, SIGILL));
+ static_assert(chk(::dux::sig::io, SIGIO));
+ static_assert(chk(::dux::sig::intr, SIGINT));
+ static_assert(chk(::dux::sig::kill, SIGKILL));
+ static_assert(chk(::dux::sig::pipe, SIGPIPE));
+ static_assert(chk(::dux::sig::prof, SIGPROF));
+ static_assert(chk(::dux::sig::quit, SIGQUIT));
+ static_assert(chk(::dux::sig::segv, SIGSEGV));
+ static_assert(chk(::dux::sig::stop, SIGSTOP));
+ static_assert(chk(::dux::sig::sys, SIGSYS));
+ static_assert(chk(::dux::sig::term, SIGTERM));
+ static_assert(chk(::dux::sig::trap, SIGTRAP));
+ static_assert(chk(::dux::sig::tstp, SIGTSTP));
+ static_assert(chk(::dux::sig::ttin, SIGTTIN));
+ static_assert(chk(::dux::sig::ttou, SIGTTOU));
+ static_assert(chk(::dux::sig::urg, SIGURG));
+ static_assert(chk(::dux::sig::usr1, SIGUSR1));
+ static_assert(chk(::dux::sig::usr2, SIGUSR2));
+ static_assert(chk(::dux::sig::vtalrm,SIGVTALRM));
+ static_assert(chk(::dux::sig::winch, SIGWINCH));
+ static_assert(chk(::dux::sig::xcpu, SIGXCPU));
+ static_assert(chk(::dux::sig::xfsz, SIGXFSZ));
+# if defined(SIGPOLL)
+ static_assert(chk(::dux::sig::poll, SIGPOLL));
+# endif
+# if defined(SIGPWR)
+ static_assert(chk(::dux::sig::pwr, SIGPWR));
+# endif
+ return true;
+}());
+
+extern "C" auto ctest(void const * params) -> void;
+
+extern "C" auto dux_main(::dux::mainparams const * const restrict _params) -> ::dux::stat {
+ if (_params->num() == dux_uwrdl(0x0)) {::dux::dbglog("dux :: demo :: No parameters!\n");}
+ else {for (auto n {dux_uwrdl(0x0)};n < _params->num();++n) {::dux::dbglog("dux :: demo :: Parameter #%zu: %s\n",n + dux_uwrdl(0x1),_params->param(n).ptr);}}
+ {
+ constexpr auto estim {dux_uint64l(0x100)};
+ ::dux::dbglog("Trying to roll two identical 8-bit numbers in a row. Estimated number of tries: " dux_printfuint64 ".\n",estim);
+ auto num0 {::dux::rnd<::dux::uint8>()};
+ auto num1 {::dux::rnd<::dux::uint8>()};
+ for (auto n = dux_uint64l(0x1);;++n) {
+ if (num0 == num1) [[unlikely]] {
+ ::dux::dbglog("Done! Took " dux_printfuint64 " attempts (estimated: " dux_printfuint64 ") to roll the same 8-bit number (" dux_printfuint8 ") two times in a row.\n",n,estim,num0);
+ ::dux::dbglog("Odds: %f%%",((double)n / (double)estim) * (double)100.0);
+ if (n == dux_uint64l(0x45)) {::dux::dbglog(" - Nice!");} /* 69 */
+ else if (n == dux_uint64l(0x1)) {::dux::dbglog(" - bruh");}
+ ::dux::dbglog("\n\nContinuing to the testing stage...\n\n");
+ goto test;
}
+ num0 = ::dux::rnd<::dux::uint8>();
+ num1 = ::dux::rnd<::dux::uint8>();
+ }
+ }
+test:;
+ auto const time = ::dux::gettime();
+ ::dux::dbglog("Current time: " dux_printfsint64 "\n",time);
+ dux_ass("",time >= dux_sint64l(0x5C10DFA4));
+ {
+ ::dux::reseterr();
+ auto const ptr {::dux::alloc<char>()};
+ dux_ass("Memory allocation failed!",!::dux::haserr());
+ ::dux::free(ptr);
+ }
+ {
+ constexpr auto val {dux_uint8l(0xC4)};
+ dux_ass("",::dux::getbit(val,0x0) == false);
+ dux_ass("",::dux::getbit(val,0x1) == false);
+ dux_ass("",::dux::getbit(val,0x2) == true);
+ dux_ass("",::dux::getbit(val,0x3) == false);
+ dux_ass("",::dux::getbit(val,0x4) == false);
+ dux_ass("",::dux::getbit(val,0x5) == false);
+ dux_ass("",::dux::getbit(val,0x6) == true);
+ dux_ass("",::dux::getbit(val,0x7) == true);
+ }
+ {
+ constexpr auto arrsz {dux_uwrdl(0x5)};
+ constexpr ::dux::uint16 arr0[] {
+ dux_uint16l(0xF),
+ dux_uint16l(0x1F),
+ dux_uint16l(0x3F),
+ dux_uint16l(0x7F),
+ dux_uint16l(0xFF),
+ };
+ auto const arr1 {::dux::alloc<::dux::uint16>(arrsz)};
+ ::dux::cpy(arr0,arrsz,arr1);
+ dux_ass("",arr1[dux_uwrdl(0x0)] == dux_uint16l(0xF));
+ dux_ass("",arr1[dux_uwrdl(0x1)] == dux_uint16l(0x1F));
+ dux_ass("",arr1[dux_uwrdl(0x2)] == dux_uint16l(0x3F));
+ dux_ass("",arr1[dux_uwrdl(0x3)] == dux_uint16l(0x7F));
+ dux_ass("",arr1[dux_uwrdl(0x4)] == dux_uint16l(0xFF));
+ ::dux::free(arr1);
+ }
+ /*{
+ auto * restrict ptr = ::dux::alloc<::dux::uint16>(dux_uwrdl(0x1));
+ *ptr = dux_uint16l(0x10);
+ dux_ass("",*ptr == dux_uint16l(0x10));
+ ptr = ::dux::realloc(ptr,dux_uwrdl(0x2));
+ ptr[dux_uwrdl(0x1)] = dux_uint16l(0x20);
+ dux_ass("",ptr[dux_uwrdl(0x0)] == dux_uint16l(0x10));
+ dux_ass("",ptr[dux_uwrdl(0x1)] == dux_uint16l(0x20));
+ ::dux::free(ptr);
+ }*/ /* Does not work as realloc currently does not support reallocating aligned allocations. */
+ {
+ constexpr auto arrsz {dux_uwrdl(0x2)};
+ ::dux::uint64 arr[arrsz];
+ ::dux::bytefill(arr,arrsz,dux_uint8l(0xFF));
+ dux_ass("",arr[dux_uwrdl(0x0)] >= dux_uint64l(0xFFFFFFFFFFFFFFFF));
+ ::dux::bytefill(arr,arrsz,dux_uint8l(0x7F));
+ dux_ass("",arr[dux_uwrdl(0x1)] >= dux_uint64l(0x7F7F7F7F7F7F7F7F));
+ }
+ {
+ ::dux::seterr(::dux::errcd::test);
+ dux_ass("Testing if the test error was set",::dux::geterr() >::dux::errcd::noerr);
+ ::dux::reseterr();
+ }
+ {
+ auto x = 0x45;
+ auto y = 0x1A4;
+ ::dux::swp(x,y);
+ dux_ass("",x == 0x1A4);
+ dux_ass("",y == 0x45);
+ }
+ {
+ ::dux::setsighandl(::dux::sig::intr,[](::dux::sig const _sig) {
+ dux_ass("",_sig == ::dux::sig::intr);
+ ::dux::local::gotsig = true;
+ return false;
+ });
+ ::dux::raise(::dux::sig::intr);
+ dux_ass("",::dux::local::gotsig);
+ ::dux::setsighandl(::dux::sig::intr,::dux::sighandl::dfl());
+ }
+ {
+ auto handl {[](::dux::sig) {return false;}};
+ ::dux::setsighandl(::dux::sig::abrt,handl);
+ auto goterr {false};
+ if (::dux::haserr()) [[unlikely]] {
+ goterr = true;
+ ::dux::reseterr();
}
- skipevt:;
+ dux_ass("",goterr);
+ }
+ {
+ auto const start {::dux::gettime()};
+ ::dux::sleep(dux_uint64l(0x2));
+ auto const stop {::dux::gettime()};
+ dux_ass("",stop - start == dux_uint64l(0x2));
+ }
+ {
+ constexpr auto arrsz {dux_uwrdl(0x8)};
+ bool arr[arrsz];
+ ::dux::plot(arr,arrsz,[](::dux::uwrd const _n) {return ::dux::isprime(_n);});
+ dux_ass("",arr[dux_uwrdl(0x0)] == false);
+ dux_ass("",arr[dux_uwrdl(0x1)] == false);
+ dux_ass("",arr[dux_uwrdl(0x2)] == true);
+ dux_ass("",arr[dux_uwrdl(0x3)] == true);
+ dux_ass("",arr[dux_uwrdl(0x4)] == false);
+ dux_ass("",arr[dux_uwrdl(0x5)] == true);
+ dux_ass("",arr[dux_uwrdl(0x6)] == false);
+ dux_ass("",arr[dux_uwrdl(0x7)] == true);
+ }
+ if (::dux::haserr()) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91mdemo\x1B[0m :: Got error %S!\n",::dux::errcdnm(::dux::geterr()));
+ ::dux::exit(::dux::stat::err);
}
- win.destr();
- ::dux::endgfx();
+ ::ctest(_params);
+ ::dux::onexit([](::dux::stat) {
+ ::dux::onexit([](::dux::stat) {});
+ dux_ass("",::dux::haserr());
+ ::dux::dbglog("dux :: demo :: All tests passed!\n");
+ });
+ ::dux::exit(::dux::stat::ok);
}
diff --git a/dux/CMakeLists.txt b/dux/CMakeLists.txt
new file mode 100644
index 0000000..9e8544b
--- /dev/null
+++ b/dux/CMakeLists.txt
@@ -0,0 +1,134 @@
+cmake_minimum_required(
+ VERSION
+ 3.19
+)
+
+# Language Standards:
+set(
+ CMAKE_C_STANDARD
+ 11
+)
+set(
+ CMAKE_C_STANDARD_REQUIRED
+ TRUE
+)
+set(
+ CMAKE_CXX_STANDARD
+ 20
+)
+set(
+ CMAKE_CXX_STANDARD_REQUIRED
+ TRUE
+)
+
+# Project:
+project(
+ dux
+ LANGUAGES
+ C
+ CXX
+ ASM # CMake recommends placing assembly as the last entry in the list of languages.
+ VERSION
+ ${DUX_VERSION}
+)
+
+# Target:
+add_library(
+ dux
+ SHARED
+ "src/priv/posix/clock_gettime.c"
+ "src/priv/posix/close.c"
+ "src/priv/posix/getpid.c"
+ "src/priv/posix/getrandom.c"
+ "src/priv/posix/kill.c"
+ "src/priv/posix/mmap.c"
+ "src/priv/posix/nanosleep.c"
+ "src/priv/posix/openat.c"
+ "src/priv/posix/sigaction.c"
+ "src/priv/posix/write.c"
+ "src/priv/alloc.cc"
+ "src/priv/assfail.c"
+ "src/priv/cpy.c"
+ "src/priv/curerrcd.c"
+ "src/priv/dbglog.c"
+ "src/priv/dbgunreach.c"
+ "src/priv/dup.c"
+ "src/priv/fill.c"
+ "src/priv/free.cc"
+ "src/priv/geterrnoptr.c"
+ "src/priv/logstderr.c"
+ "src/priv/nomedia.c"
+ "src/priv/plot.c"
+ "src/priv/start.cc"
+ "src/priv/syscall.S"
+ "src/abrt.cc"
+ "src/alloc.cc"
+ "src/errcdnm.cc"
+ "src/exit.cc"
+ "src/fndchr.cc"
+ "src/free.cc"
+ "src/freernd.cc"
+ "src/getallocsz.cc"
+ "src/getenv.cc"
+ "src/getmainparam.cc"
+ "src/getnummainparams.cc"
+ "src/gettime.cc"
+ "src/mainparams.cc"
+ "src/onexit.cc"
+ "src/raise.cc"
+ "src/realloc.cc"
+ "src/rnd.cc"
+ "src/setsighandl.cc"
+ "src/sleep.cc"
+ "src/strcmp.cc"
+ "src/strcpy.cc"
+ "src/strdup.cc"
+ "src/streq.cc"
+ "src/strlen.cc"
+ "src/trap.cc"
+)
+
+# Compiler Settings:
+target_compile_options(
+ dux
+ PRIVATE
+ -Wfatal-errors
+ -Wall
+ -Wconversion
+ -Werror
+ -Wextra
+ -Wunreachable-code
+ -Wunused
+ -fdiagnostics-color=always
+ -g
+ -pedantic-errors
+ $<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:-Og>
+ $<$<STREQUAL:${CMAKE_BUILD_TYPE},Release>:-O3>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wmissing-declarations>
+ $<$<COMPILE_LANGUAGE:C>:-Wmissing-prototypes>
+ $<$<OR:$<COMPILE_LANG_AND_ID:C,Clang>,$<COMPILE_LANG_AND_ID:CXX,Clang>>:-Wnewline-eof>
+ $<$<COMPILE_LANGUAGE:Fortran>:-Wno-compare-reals>
+)
+
+# Include Directories:
+target_include_directories(
+ dux
+ PUBLIC
+ "include"
+)
+target_include_directories(
+ dux
+ PRIVATE
+ "include-priv"
+)
+
+# Macro Definitions:
+if(
+ DUX_DISABLE_MEDIA
+)
+ target_compile_definitions(
+ dux
+ PRIVATE
+ dux_priv_dis_media
+ )
+endif()
diff --git a/dux/include-priv/dux/c/priv.h b/dux/include-priv/dux/c/priv.h
new file mode 100644
index 0000000..86f5c17
--- /dev/null
+++ b/dux/include-priv/dux/c/priv.h
@@ -0,0 +1,18 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
diff --git a/include/dux/cstr.hh b/dux/include-priv/dux/cxx/priv.hh
index 7361f90..177369d 100644
--- a/include/dux/cstr.hh
+++ b/dux/include-priv/dux/cxx/priv.hh
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,14 +17,16 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-namespace dux {
- [[nodiscard]] constexpr auto cstrcmp(char const * lstr,char const * rstr) noexcept -> ::dux::sbyte;
- [[nodiscard]] constexpr auto cstrcpy(char * dest,char const * src) noexcept -> char *;
- [[nodiscard]] constexpr auto cstrdup(char const * str) -> char *;
- [[nodiscard]] constexpr auto cstrlen(char const * str) noexcept -> ::dux::usz;
-}
+# include <atomic>
+# include <csetjmp>
+
+namespace dux::priv {
+ inline ::std::jmp_buf exitjmp;
+ inline ::dux::stat volatile exitstat;
-#include <dux/cstr.d/cstrcmp.hh>
-#include <dux/cstr.d/cstrcpy.hh>
-#include <dux/cstr.d/cstrdup.hh>
-#include <dux/cstr.d/cstrlen.hh>
+ constexpr auto maxnumonexitfns {dux_uwrdl(0x100)};
+ inline ::std::atomic<bool> exitlock;
+ inline ::dux::priv::onexitfn onexitfns[::dux::priv::maxnumonexitfns];
+ inline ::std::atomic<bool> onexitlock;
+ inline auto numonexitfns {dux_uwrdl(0x0)};
+}
diff --git a/dux/include-priv/dux/priv b/dux/include-priv/dux/priv
new file mode 100644
index 0000000..cef96fa
--- /dev/null
+++ b/dux/include-priv/dux/priv
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/base>
+
+# include <dux/priv.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/priv.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/priv.hh>
+# endif
diff --git a/dux/include-priv/dux/priv.h b/dux/include-priv/dux/priv.h
new file mode 100644
index 0000000..4214e56
--- /dev/null
+++ b/dux/include-priv/dux/priv.h
@@ -0,0 +1,41 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <signal.h>
+# include <sys/mman.h>
+# include <sys/types.h>
+# include <time.h>
+# include <unistd.h>
+
+dux_priv_begincdecls
+
+dux_attr_const int * dux_priv_geterrnoptr(void);
+# define dux_priv_errno (*dux_priv_geterrnoptr())
+
+int dux_priv_posix_clock_gettime(clockid_t clockid,struct timespec * tp);
+pid_t dux_priv_posix_getpid( void);
+pid_t dux_priv_posix_gettid( void);
+int dux_priv_posix_kill( pid_t pid, int sig);
+void * dux_priv_posix_mmap( void * addr, dux_priv_uwrd length,int prot, int flags,int fd,off_t offset);
+int dux_priv_posix_nanosleep( struct timespec const * req, struct timespec * rem);
+int dux_priv_posix_sigaction( int signum, struct sigaction const * act, struct sigaction * oldact);
+
+int dux_priv_start(int argc,char const * const * argv);
+
+dux_priv_endcdecls
diff --git a/include/dux/base b/dux/include/dux/arr
index bec2c6e..307cb9c 100644
--- a/include/dux/base
+++ b/dux/include/dux/arr
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,9 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_base)
-#define dux_hdr_base
+# pragma once
-#include <dux/base.hh>
+# include <dux/mem>
-#endif
+# include <dux/arr.h>
diff --git a/dux/include/dux/arr.h b/dux/include/dux/arr.h
new file mode 100644
index 0000000..66bf351
--- /dev/null
+++ b/dux/include/dux/arr.h
@@ -0,0 +1,99 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# if defined(dux_lang_cxx)
+
+namespace dux {
+ template<typename T> class arr {
+ public:
+ [[nodiscard]] constexpr arr() noexcept : _isalloc(false) {}
+ [[nodiscard]] constexpr arr(::dux::arr<T> && _oth) noexcept : _dat(_oth._dat), _isalloc(_oth._isalloc),_sz(_oth._sz) {_oth.kill();}
+ [[nodiscard]] constexpr arr(T * const restrict _dat, ::dux::uwrd const _sz,bool const _isalloc = false) noexcept : _dat(_dat), _isalloc(_isalloc), _sz(_sz) {}
+ template<::dux::uwrd N> [[nodiscard]] constexpr arr(T const (& _arr)[N]) noexcept : _dat(const_cast<char *>(_arr)),_isalloc(false), _sz(N) {}
+
+ constexpr auto operator = (::dux::arr<T> const & _oth) noexcept -> ::dux::arr<T> const & {
+ if (_oth._isalloc) {
+ this->alloc(_oth.sz());
+ ::dux::cpy(_oth.dat(),_oth.sz(),this->dat());
+ }
+ else {this->setraw(_oth._dat,_oth._sz,_oth._isalloc);}
+ return *this;
+ }
+
+ constexpr auto operator = (::dux::arr<T> const && _oth) noexcept -> ::dux::arr<T> const & {
+ this->setraw(_oth.alloc,_oth._dat,_oth._sz);
+ _oth._isalloc = false; /* Mutable field. */
+ return *this;
+ }
+
+ constexpr ~arr() noexcept {if (this->_isalloc) {::dux::free(this->_dat);}}
+
+ constexpr auto dat() noexcept -> T * {return this->_dat;}
+ constexpr auto dat() const noexcept -> T const * {return this->_dat;}
+ constexpr auto sz() const noexcept -> ::dux::uwrd {return this->_sz;}
+
+ constexpr auto begin() noexcept -> T * {return this->dat();}
+ constexpr auto begin() const noexcept -> T const * {return this->dat();}
+ constexpr auto end() noexcept -> T * {return this->dat() + this->sz();}
+ constexpr auto end() const noexcept -> T const * {return this->dat() + this->sz();}
+ constexpr auto cbegin() const noexcept -> T const * {return this->begin();}
+ constexpr auto cend() const noexcept -> T const * {return this->end();}
+
+ constexpr auto operator [] (::dux::uwrd const _n) noexcept -> T & {return this->_dat[_n];}
+ constexpr auto operator [] (::dux::uwrd const _n) const noexcept -> T const & {return this->_dat[_n];}
+
+ constexpr auto setraw(T * const restrict _dat,::dux::uwrd const _sz,bool const _isalloc = false) noexcept -> void {
+ this->_isalloc = _isalloc;
+ this->_dat = _dat;
+ this->_sz = _sz;
+ }
+ constexpr auto setraw(T const * const restrict _dat,::dux::uwrd const _sz) noexcept -> void {
+ this->_isalloc = false;
+ this->_dat = const_cast<T *>(_dat);
+ this->_sz = _sz;
+ }
+
+ constexpr auto kill() noexcept -> void {
+ this->_dat = nullptr;
+ this->_isalloc = false;
+ }
+
+ constexpr auto alloc(::dux::uwrd const _sz) noexcept -> void {
+ this->_dat = ::dux::alloc<T>(_sz);
+ if (::dux::haserr()) [[unlikely]] {
+ this->_isalloc = false;
+ return;
+ }
+ this->_isalloc = true;
+ this->_sz = _sz;
+ }
+ constexpr auto free() noexcept -> void {
+ if (!this->_isalloc) [[unlikely]] {return;}
+ ::dux::free(this->_dat);
+ this->_isalloc = false;
+ this->_sz = dux_uwrdl(0x0);
+ }
+ private:
+ T * _dat;
+ bool mutable _isalloc;
+ ::dux::uwrd _sz;
+ };
+}
+
+# endif
diff --git a/dux/include/dux/base b/dux/include/dux/base
new file mode 100644
index 0000000..3fd745d
--- /dev/null
+++ b/dux/include/dux/base
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/sysinfo.h>
+
+# include <dux/base.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/base.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/base.hh>
+# endif
diff --git a/dux/include/dux/base.h b/dux/include/dux/base.h
new file mode 100644
index 0000000..b31f976
--- /dev/null
+++ b/dux/include/dux/base.h
@@ -0,0 +1,558 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
+ This is the base of the "dux General Library", a library aimed at replacing the C++ standard library.
+
+ We must implement as much as humanly possible ourselves. We are never allowed to include third-party headers EXCEPT the "exception" header.
+*/
+
+/*
+ Header dependencies:
+
+ sysinfo.h > base >┬> math ─> seq > mem >┬> arr > io >
+ │ ╰> str ─────>
+ ├> media ─────────────────────────>
+ ├> sig ───────────────────────────>
+ ├> thrd ──────────────────────────>
+ ╰> time ──────────────────────────>
+
+ All headers up to (and including) "runmath" and "sys" are C-compatible. Moreover, this header is C90-compatible.
+*/
+
+# if defined(dux_lang_c)
+# if !defined(dux_lang_c11)
+# error Header must be included from C11 or later!
+# endif
+# elif defined(dux_lang_cxx)
+# if !defined(dux_lang_cxx20)
+# error Header must be included from C++20 or later!
+# endif
+# else
+# error Header must be included from C or C++!
+# endif
+
+
+# if defined(dux_lang_c)
+# include <stdbool.h> /* We really want the bool macros. We can't define them ourselves, as that would be UB (note: read next line), as we may not declare nor define anything the standard library defines. */
+# undef false /* NOT UB: cppreference: "A program may undefine and perhaps then redefine the macros bool, true and false." (cppreference) */
+# undef true
+/* We want to define our own values for true and false, as, prior to C2x, their types were int instead of _Bool. */
+# define false ((_Bool)+0u)
+# define true ((_Bool)+1u)
+# endif
+
+# if defined(dux_lang_cxx)
+# undef restrict
+# if defined(dux_priv_gnuc) || defined(dux_cmpl_msvc)
+# define restrict __restrict
+# else
+# define restrict
+# endif
+# endif
+
+# define dux_priv_ver 0x1E
+
+# if !defined(dux_dbg)
+# if defined(_DEBUG) || !defined(NDEBUG)
+# define dux_dbg true
+# else
+# define dux_dbg false
+# endif
+# else
+# if dux_dbg != false && dux_dbg != true
+# error Invalid user-defined value for dux_dbg!
+# endif
+# endif
+
+# if defined(__GNUC__)
+# define dux_priv_gnuc
+# endif
+
+# if defined(__clang__)
+# define dux_priv_hasclangattr true
+# else
+# define dux_priv_hasclangattr false
+# endif
+# if defined(dux_priv_gnuc)
+# define dux_priv_hasgnuattr true
+# else
+# define dux_priv_hasgnuattr false
+# endif
+# if defined(_MSC_VER)
+# define dux_priv_hasmsvcattr true
+# else
+# define dux_priv_hasmsvcattr false
+# endif
+
+# if defined(__has_builtin)
+# define dux_hasbuiltin(_builtin) __has_builtin(_builtin)
+# else
+# define dux_hasbuiltin(_builtin) false
+# endif
+
+# if dux_hasbuiltin(__builtin_FILE) && dux_hasbuiltin(__builtin_FUNCTION) && dux_hasbuiltin(__builtin_LINE)
+# define dux_priv_builtinfile() (__builtin_FILE())
+# define dux_priv_builtinfunc() (__builtin_FUNCTION())
+# define dux_priv_builtinline() ((long)__builtin_LINE())
+# else
+# define dux_priv_builtinfile() ("")
+# define dux_priv_builtinfunc() ("")
+# define dux_priv_builtinline() (0x0l)
+# endif
+
+# define dux_priv_pragmanostr(_str) _Pragma(#_str)
+# if defined(dux_cmpl_msvc)
+# define dux_ppmsg(_msg) dux_priv_pragmanostr(message("\"" _msg "\""))
+# elif defined(dux_priv_gnuc)
+# define dux_ppmsg(_msg) dux_priv_pragmanostr(message "\"" _msg "\"")
+# else
+# define dux_ppmsg(_msg)
+# endif
+
+# if defined(dux_lang_c)
+# define dux_priv_noret _Noreturn
+# elif defined(dux_lang_cxx)
+# define dux_priv_noret [[noreturn]]
+# endif
+
+# if defined(dux_lang_c)
+# define dux_priv_thrdlocal _Thread_local
+# elif defined(dux_lang_cxx)
+# define dux_priv_thrdlocal thread_local
+# endif
+
+# if defined(dux_lang_c23) || defined(dux_lang_cxx)
+# define dux_attr_unused [[maybe_unused]]
+# elif dux_priv_hasgnuattr
+# define dux_attr_unused __attribute__((unused))
+# else
+# define dux_attr_unused
+# endif
+# if defined(dux_lang_c23) || defined(dux_lang_cxx)
+# define dux_attr_useret [[nodiscard]]
+# elif dux_priv_hasgnuattr
+# define dux_attr_useret __attribute__((warn_unused_result))
+# else
+# define dux_attr_useret
+# endif
+# if dux_priv_hasgnuattr
+# if defined(dux_lang_c23) || defined(dux_lang_cxx)
+# define dux_attr_allocsz( ...) [[gnu::alloc_size(__VA_ARGS__)]]
+# define dux_attr_artif [[gnu::artificial]]
+# define dux_attr_cold [[gnu::cold]]
+# define dux_attr_const [[gnu::const]]
+# define dux_attr_flatten [[gnu::flatten]]
+# define dux_attr_hot [[gnu::hot]]
+# define dux_attr_inline [[gnu::always_inline]]
+# define dux_attr_malloc [[gnu::malloc]]
+# define dux_attr_nonnull( ...) [[gnu::nonnull(__VA_ARGS__)]]
+# define dux_attr_pure [[gnu::pure]]
+# define dux_attr_retnonnull [[gnu::returns_nonnull]]
+# define dux_attr_sect( ...) [[gnu::section(__VA_ARGS__)]]
+# else
+# define dux_attr_allocsz( ...) __attribute__((alloc_size(__VA_ARGS__)))
+# define dux_attr_artif __attribute__((artificial))
+# define dux_attr_cold __attribute__((cold))
+# define dux_attr_const __attribute__((const))
+# define dux_attr_flatten __attribute__((flatten))
+# define dux_attr_hot __attribute__((hot))
+# define dux_attr_inline __attribute__((always_inline))
+# define dux_attr_malloc __attribute__((malloc))
+# define dux_attr_nonnull( ...) __attribute__((nonnull(__VA_ARGS__)))
+# define dux_attr_pure __attribute__((pure))
+# define dux_attr_retnonnull __attribute__((returns_nonnull))
+# define dux_attr_sect( ...) __attribute__((section(__VA_ARGS__)))
+# endif
+# else
+# define dux_attr_allocsz( ...)
+# define dux_attr_artif
+# define dux_attr_cold
+# define dux_attr_const
+# define dux_attr_flatten
+# define dux_attr_hot
+# define dux_attr_inline
+# define dux_attr_malloc
+# define dux_attr_nonnull( ...)
+# define dux_attr_pure
+# define dux_attr_retnonnull
+# define dux_attr_sect( ...)
+# endif
+# if dux_priv_hasclangattr
+# if defined(dux_lang_c23) || defined(dux_lang_cxx)
+# define dux_attr_noderef [[clang::noderef]]
+# define dux_attr_noesc( ...) [[clang::noescape(__VA_ARGS__)]]
+# else
+# define dux_attr_noderef __attribute__((noderef))
+# define dux_attr_noesc( ...) __attribute__((noescape(__VA_ARGS__)))
+# endif
+# else
+# define dux_attr_noderef
+# define dux_attr_noesc( ...)
+# endif
+
+# if defined(dux_lang_c)
+# define dux_fnnm __func__
+# elif defined(dux_lang_cxx)
+# if defined(dux_priv_gnuc)
+# define dux_fnnm __PRETTY_FUNCTION__
+# elif defined(dux_cmpl_msvc)
+# define dux_fnnm __FUNCSIG__
+# else
+# define dux_fnnm __func__
+# endif
+# endif
+
+# if defined(dux_lang_c)
+# define dux_nullptr ((void *)0x0)
+# define dux_priv_nullptr dux_nullptr
+# elif defined(dux_lang_cxx)
+# define dux_priv_nullptr nullptr
+# endif
+
+/* Cross-language branch prediction: */
+# if defined(dux_lang_c)
+# if dux_hasbuiltin(__builtin_expect)
+# define dux_priv_likely(_expr) if (__builtin_expect(_expr,true))
+# define dux_priv_unlikely(_expr) if (__builtin_expect(_expr,false))
+# else
+# define dux_priv_likely(_expr) if (_expr)
+# define dux_priv_unlikely(_expr) if (_expr)
+# endif
+# elif defined(dux_lang_cxx)
+# define dux_priv_likely(_expr) if (_expr) [[likely]]
+# define dux_priv_unlikely(_expr) if (_expr) [[unlikely]]
+# endif
+
+/* If-consteval before C++23: */
+# if defined(dux_lang_cxx)
+# if defined(__cpp_if_consteval)
+# define dux_priv_ifconsteval if consteval
+# define dux_priv_ifnotconsteval if not consteval
+# else
+# define dux_priv_ifconsteval if (__builtin_is_constant_evaluated())
+# define dux_priv_ifnotconsteval if (!__builtin_is_constant_evaluated())
+# endif
+# endif
+
+/* C-declerations in C++:<2 */
+# if defined(dux_lang_c)
+# define dux_priv_begincdecls
+# define dux_priv_endcdecls
+# elif defined(dux_lang_cxx)
+# define dux_priv_begincdecls extern "C" {
+# define dux_priv_endcdecls }
+# endif
+
+# define dux_priv_uint8max (dux_uchrmax)
+# define dux_priv_sint8max (dux_schrmax)
+# define dux_uint8l(_lit) ((unsigned char)_lit)
+# define dux_sint8l(_lit) ((signed char)_lit)
+# define dux_printfuint8 "%hhu"
+# define dux_printfsint8 "%hhi"
+typedef unsigned char dux_priv_uint8;
+typedef signed char dux_priv_sint8;
+
+# if dux_bytesz >= 0x10
+# define dux_priv_uint16max (dux_uchrmax)
+# define dux_priv_sint16max (dux_schrmax)
+# define dux_uint16l(_lit) (unsigned char)_lit
+# define dux_sint16l(_lit) (signed char)_lit
+# define dux_printfuint16 "%hhu"
+# define dux_printfsint16 "%hhi"
+typedef unsigned char dux_priv_uint16;
+typedef signed char dux_priv_sint16;
+# else
+# define dux_priv_uint16max (dux_ushrtmax)
+# define dux_priv_sint16max (dux_shrtmax)
+# define dux_uint16l(_lit) (unsigned short)_lit
+# define dux_sint16l(_lit) (short)_lit
+# define dux_printfuint16 "%hu"
+# define dux_printfsint16 "%hi"
+typedef unsigned short dux_priv_uint16;
+typedef short dux_priv_sint16;
+# endif
+
+# if dux_bytesz >= 0x20
+# define dux_priv_uint32max (dux_uchrmax)
+# define dux_priv_sint32max (dux_schrmax)
+# define dux_uint32l(_lit) (unsigned char)_lit
+# define dux_sint32l(_lit) (signed char)_lit
+# define dux_printfuint32 "%hhu"
+# define dux_printfsint32 "%hhi"
+typedef unsigned char dux_priv_uint32;
+typedef signed char dux_priv_sint32;
+# elif dux_shrtmax >= 0x7FFFFFFF
+# define dux_priv_uint32max (dux_ushrtmax)
+# define dux_priv_sint32max (dux_shrtmax)
+# define dux_uint32l(_lit) (unsigned short)_lit
+# define dux_sint32l(_lit) (short)_lit
+# define dux_printfuint32 "%hu"
+# define dux_printfsint32 "%hi"
+typedef unsigned short dux_priv_uint32;
+typedef short dux_priv_sint32;
+# elif dux_intmax >= 0x7FFFFFFF
+# define dux_priv_uint32max (dux_uintmax)
+# define dux_priv_sint32max (dux_intmax)
+# define dux_uint32l(_lit) _lit ## u
+# define dux_sint32l(_lit) _lit
+# define dux_printfuint32 "%u"
+# define dux_printfsint32 "%i"
+typedef unsigned int dux_priv_uint32;
+typedef int dux_priv_sint32;
+# else
+# define dux_priv_uint32max (dux_ulngmax)
+# define dux_priv_sint32max (dux_lngmax)
+# define dux_uint32l(_lit) _lit ## ul
+# define dux_sint32l(_lit) _lit ## l
+# define dux_printfuint32 "%lu"
+# define dux_printfsint32 "%li"
+typedef unsigned long dux_priv_uint32;
+typedef long dux_priv_sint32;
+# endif
+
+# if dux_bytesz >= 0x40
+# define dux_priv_uint64max (dux_uchrmax)
+# define dux_priv_sint64max (dux_schrmax)
+# define dux_uint64l(_lit) (unsigned char)_lit
+# define dux_sint64l(_lit) (signed char)_lit
+# define dux_printfuint64 "%hhu"
+# define dux_printfsint64 "%hhi"
+typedef unsigned char dux_priv_uint64;
+typedef signed char dux_priv_sint64;
+# elif dux_shrtmax >= 0x7FFFFFFFFFFFFFFF
+# define dux_priv_uint64max (dux_ushrtmax)
+# define dux_priv_sint64max (dux_shrtmax)
+# define dux_uint64l(_lit) (unsigned short>_lit
+# define dux_sint64l(_lit) (short)_lit
+# define dux_printfuint64 "%hu"
+# define dux_printfsint64 "%hi"
+typedef unsigned short dux_priv_uint64;
+typedef short dux_priv_sint64;
+# elif dux_intmax >= 0x7FFFFFFFFFFFFFFF
+# define dux_priv_uint64max (dux_uintmax)
+# define dux_priv_sint64max (dux_intmax)
+# define dux_uint64l(_lit) _lit ## u
+# define dux_sint64l(_lit) _lit
+# define dux_printfuint64 "%u"
+# define dux_printfsint64 "%i"
+typedef unsigned int dux_priv_uint64;
+typedef int dux_priv_sint64;
+# elif dux_lngmax >= 0x7FFFFFFFFFFFFFFF
+# define dux_priv_uint64max (dux_ulngmax)
+# define dux_sint64max (dux_lngmax)
+# define dux_uint64l(_lit) _lit ## ul
+# define dux_sint64l(_lit) _lit ## l
+# define dux_printfuint64 "%lu"
+# define dux_printfsint64 "%li"
+typedef unsigned long dux_priv_uint64;
+typedef long dux_priv_sint64;
+# else
+# define dux_priv_uint64max (dux_ullngmax)
+# define dux_priv_sint64max (dux_llngmax)
+# define dux_uint64l(_lit) _lit ## ull
+# define dux_sint64l(_lit) _lit ## l
+# define dux_printfuint64 "%llu"
+# define dux_printfsint64 "%lli"
+typedef unsigned long long dux_priv_uint64;
+typedef long long dux_priv_sint64;
+# endif
+
+# if dux_wrdsz == 0x8
+# define dux_priv_uwrdmax (dux_uint8max)
+# define dux_priv_swrdmax (dux_sint8max)
+# define dux_uwrdl(_lit) dux_uint8l(_lit)
+# define dux_swrdl(_lit) dux_sint8l(_lit)
+/* We do not need to define the printf conversion specifier strings, as printf has a built-in one ("zi" and "zu"). */
+typedef dux_priv_uint8 dux_priv_uwrd;
+typedef dux_priv_sint8 dux_priv_swrd;
+# elif dux_wrdsz == 0x10
+# define dux_priv_uwrdmax (dux_uint16max)
+# define dux_priv_swrdmax (dux_sint16max)
+# define dux_uwrdl(_lit) dux_uint16l(_lit)
+# define dux_swrdl(_lit) dux_sint16l(_lit)
+typedef dux_priv_uint16 dux_priv_uwrd;
+typedef dux_priv_sint16 dux_priv_swrd;
+# elif dux_wrdsz == 0x20
+# define dux_priv_uwrdmax (dux_uint32max)
+# define dux_priv_swrdmax (dux_sint32max)
+# define dux_uwrdl(_lit) dux_uint32l(_lit)
+# define dux_swrdl(_lit) dux_sint32l(_lit)
+typedef dux_priv_uint32 dux_priv_uwrd;
+typedef dux_priv_sint32 dux_priv_swrd;
+# elif dux_wrdsz == 0x40
+# define dux_priv_uwrdmax (dux_uint64max)
+# define dux_priv_swrdmax (dux_sint64max)
+# define dux_uwrdl(_lit) dux_uint64l(_lit)
+# define dux_swrdl(_lit) dux_sint64l(_lit)
+typedef dux_priv_uint64 dux_priv_uwrd;
+typedef dux_priv_sint64 dux_priv_swrd;
+# else /* The word size was larger than the size of dux_*int64, meaning we will have to resort the the largest integer type with literals. This is long long, which may be larger than dux_int64. */
+# define dux_priv_uwrdmax (dux_ullngmax)
+# define dux_priv_swrdmax (dux_llngmax)
+# define dux_uwrdl(_lit) _lit ## ull
+# define dux_swrdl(_lit) _lit ## ll
+typedef unsigned long long dux_priv_uwrd;
+typedef long long dux_priv_swrd;
+# endif
+# if defined(dux_lang_cxx23) /* C++23 has literals for the type ::std::size_t, which dux_wrd replaces. Use these instead, if available. */
+# undef dux_uwrdl
+# undef dux_swrdl
+# define dux_uwrdl(_lit) _lit ## uz
+# define dux_swrdl(_lit) _lit ## z
+# endif
+
+# if defined(dux_lang_c)
+typedef dux_priv_uint16 dux_priv_chr16;
+typedef dux_priv_uint32 dux_priv_chr32;
+typedef dux_priv_uint8 dux_priv_chr8;
+# elif defined(dux_lang_cxx)
+typedef char16_t dux_priv_chr16;
+typedef char32_t dux_priv_chr32;
+typedef char8_t dux_priv_chr8;
+# endif
+
+# if defined(dux_lang_c)
+# if defined(__WCHAR_TYPE__)
+typedef __WCHAR_TYPE__ dux_priv_wchr;
+# else
+typedef dux_priv_sint32 dux_priv_wchr;
+# endif
+# elif defined(dux_lang_cxx)
+using dux_priv_wchr = wchar_t;
+# endif
+
+enum dux_priv_stat {
+# if defined(dux_os_openvms) /* On OpenVMS, 0 indicates error and 1 indicates success. Source: <https://web.archive.org/web/20120319171215/http://h71000.www7.hp.com/commercial/c/docs/5492profile_016.html> */
+ dux_priv_stat_err = 0x0, /* Error */
+ dux_priv_stat_ok = 0x1, /* Okay */
+# else
+ dux_priv_stat_err = 0x1,
+ dux_priv_stat_ok = 0x0,
+# endif
+ dux_priv_stat_badop = 0x7F, /* Bad operation */
+ dux_priv_stat_illop = 0x7E, /* Illegal operation */
+ dux_priv_stat_max = 0xFF, /* Maximum valid status code */
+};
+
+/*
+ dux has it's own error handling system.
+ It works by having a global, thread-lcaol variable, which can be accessed by dux_geterr, set by dux_seterr, and reset by dux_reseterr. If an error has occured, dux_onerr can be used.
+ The error codes are somewhat inspired by the ones POSIX uses for errno.
+*/
+enum dux_priv_errcd {
+ dux_priv_errcd_noerr = 0x0, /* No error: No error has occured */
+ dux_priv_errcd_again, /* Again: Try operating again */
+ dux_priv_errcd_badacs, /* Bad access: Access denied */
+ dux_priv_errcd_badaddr, /* Bad address: Addres was out of bounds or invalid */
+ dux_priv_errcd_badalloc, /* Bad allocation: Memory allocation failed */
+ dux_priv_errcd_badio, /* Bad input/output: Unable to read or write to pipe */
+ dux_priv_errcd_badperms, /* Bad permissions: Operation was not permitted */
+ dux_priv_errcd_badpipe, /* Bad pipe: Pipe was not valid */
+ dux_priv_errcd_badseq, /* Bad sequence: Memory sequence is illegal */
+ dux_priv_errcd_badstr, /* Bad string: String was invalid */
+ dux_priv_errcd_badutf, /* Bad UTF: UTF codepoint was illegal */
+ dux_priv_errcd_bigfile, /* Big file: File cannot grow */
+ dux_priv_errcd_illcallseq, /* Illegal call sequence: Function was called in an illegal order */
+ dux_priv_errcd_illparam, /* Illegal parameter: Provided parameter was not valid */
+ dux_priv_errcd_illsz, /* Illegal size: Size was illegal */
+ dux_priv_errcd_matherr, /* Mathematical error: Mathematical operation(s) could not be performed */
+ dux_priv_errcd_nodir, /* No directory: Directory does not exist */
+ dux_priv_errcd_nofile, /* No file: File does not exist */
+ dux_priv_errcd_noimpl, /* No implementaton: The function is not implemented on the target platform */
+ dux_priv_errcd_nospc, /* No space: Destination is out of available space */
+ dux_priv_errcd_outofrange, /* Out of range: Provided value is out of range */
+ dux_priv_errcd_runerr, /* Runtime error: An unpredictable error occured */
+ dux_priv_errcd_test, /* Test: The error system is being tested */
+ dux_priv_errcd_thrderr, /* Thread error: Unable to manipulate thread */
+};
+
+# if defined(dux_lang_c)
+# define dux_priv_str dux_str
+# elif defined(dux_lang_cxx)
+# define dux_priv_str dux_priv_str
+# endif
+struct dux_priv_str {
+ char const * ptr;
+ dux_priv_uwrd sz;
+};
+# undef dux_priv_str
+
+dux_priv_begincdecls
+
+dux_attr_hot dux_priv_uwrd dux_priv_syscall(dux_priv_uwrd syscallid,...);
+
+/* POSIX functions we implement ourselves. If the function uses a non-fundamental type, we put it in the private header. */
+int dux_priv_posix_close( int fildes);
+dux_priv_swrd dux_priv_posix_write( int fildes, void const * buf, dux_priv_uwrd nbyte);
+dux_priv_swrd dux_priv_posix_getrandom(void * buf, dux_priv_uwrd buflen, unsigned int flags);
+int dux_priv_posix_openat( int fd, char const * pathname,int flags);
+
+dux_priv_endcdecls
+
+# if !defined(dux_os_posix)
+# define dux_priv_nosigtrap
+# endif
+
+# if defined(dux_lang_c)
+# define dux_priv_trap() dux_trap()
+# elif defined(dux_lang_cxx)
+# define dux_priv_trap() ::dux::trap()
+# endif
+
+dux_priv_begincdecls
+
+dux_priv_noret void dux_priv_dbgunreach(char const * file,long line);
+
+dux_priv_endcdecls
+
+# if dux_dbg
+# define dux_priv_unreach() dux_priv_dbgunreach(__FILE__,__LINE__)
+# elif defined(dux_cmpl_icc) || defined(dux_cmpl_msvc)
+# define dux_priv_unreach() (__assume(false))
+# elif dux_hasbuiltin(__builtin_unreachable)
+# define dux_priv_unreach() (__builtin_unreachable())
+# elif dux_hasbuiltin(__builtin_trap)
+# define dux_priv_unreach() (__builtin_trap())
+# else
+# define dux_priv_unreach() (dux_priv_trap())
+# endif
+
+extern dux_priv_thrdlocal enum dux_priv_errcd dux_priv_curerrcd;
+
+# if defined(dux_lang_c)
+# define dux_priv_reseterr() dux_reseterr()
+# elif defined(dux_lang_cxx)
+# define dux_priv_reseterr() ::dux::reseterr()
+# endif
+
+dux_priv_begincdecls
+
+dux_attr_cold dux_priv_noret void dux_priv_assfail(char const * filenm,unsigned long ln,char const * fn,char const * msg,char const * exprestr);
+# if dux_dbg
+# define dux_ass(_msg,_expr) (!(_expr) ? dux_priv_assfail(__FILE__,(unsigned long)__LINE__,dux_fnnm,_msg,#_expr) : (void)0x0)
+# else
+# define dux_ass(_msg,_expr)
+# endif
+
+dux_attr_nonnull(0x1) void dux_priv_logstderr(char const * str);
+
+dux_attr_nonnull(0x1) void dux_priv_dbglog(char const * str,...);
+
+dux_priv_endcdecls
diff --git a/dux/include/dux/c/base.h b/dux/include/dux/c/base.h
new file mode 100644
index 0000000..9cfa0c0
--- /dev/null
+++ b/dux/include/dux/c/base.h
@@ -0,0 +1,128 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# define dux_likely( _expr) dux_priv_likely( _expr)
+# define dux_unlikely(_expr) dux_priv_unlikely(_expr)
+
+typedef dux_priv_uint8 dux_uint8;
+typedef dux_priv_sint8 dux_sint8;
+typedef dux_priv_uint16 dux_uint16;
+typedef dux_priv_sint16 dux_sint16;
+typedef dux_priv_uint32 dux_uint32;
+typedef dux_priv_sint32 dux_sint32;
+typedef dux_priv_uint64 dux_uint64;
+typedef dux_priv_sint64 dux_sint64;
+
+typedef dux_priv_uwrd dux_uwrd;
+typedef dux_priv_swrd dux_swrd;
+
+typedef dux_priv_chr16 dux_chr16;
+typedef dux_priv_chr32 dux_chr32;
+typedef dux_priv_chr8 dux_chr8;
+typedef dux_priv_wchr dux_wchr;
+
+/* Identifications for fundamental types: */
+enum dux_typid {
+ dux_typid_bool,
+ dux_typid_chr,
+ dux_typid_chr16,
+ dux_typid_chr32,
+ dux_typid_chr8,
+ dux_typid_dbl,
+ dux_typid_flt,
+ dux_typid_flt128,
+ dux_typid_int,
+ dux_typid_int128,
+ dux_typid_ldbl,
+ dux_typid_llng,
+ dux_typid_lng,
+ dux_typid_nullptrtyp,
+ dux_typid_schr,
+ dux_typid_shrt,
+ dux_typid_uchr,
+ dux_typid_unknwn,
+ dux_typid_ushrt,
+ dux_typid_uint,
+ dux_typid_uint128,
+ dux_typid_ullng,
+ dux_typid_ulng,
+ dux_typid_void,
+ dux_typid_wchr,
+};
+
+enum dux_stat {
+ dux_stat_badop = dux_priv_stat_badop,
+ dux_stat_err = dux_priv_stat_err,
+ dux_stat_illop = dux_priv_stat_illop,
+ dux_stat_max = dux_priv_stat_max,
+ dux_stat_ok = dux_priv_stat_ok,
+};
+
+enum dux_errcd {
+ dux_errcd_noerr = dux_priv_errcd_noerr,
+ dux_errcd_again = dux_priv_errcd_again,
+ dux_errcd_badacs = dux_priv_errcd_badacs,
+ dux_errcd_badaddr = dux_priv_errcd_badaddr,
+ dux_errcd_badalloc = dux_priv_errcd_badalloc,
+ dux_errcd_badio = dux_priv_errcd_badio,
+ dux_errcd_badperms = dux_priv_errcd_badperms,
+ dux_errcd_badpipe = dux_priv_errcd_badpipe,
+ dux_errcd_badseq = dux_priv_errcd_badseq,
+ dux_errcd_badstr = dux_priv_errcd_badstr,
+ dux_errcd_badutf = dux_priv_errcd_badutf,
+ dux_errcd_bigfile = dux_priv_errcd_bigfile,
+ dux_errcd_illcallseq = dux_priv_errcd_illcallseq,
+ dux_errcd_illparam = dux_priv_errcd_illparam,
+ dux_errcd_illsz = dux_priv_errcd_illsz,
+ dux_errcd_matherr = dux_priv_errcd_matherr,
+ dux_errcd_nodir = dux_priv_errcd_nodir,
+ dux_errcd_nofile = dux_priv_errcd_nofile,
+ dux_errcd_noimpl = dux_priv_errcd_noimpl,
+ dux_errcd_nospc = dux_priv_errcd_nospc,
+ dux_errcd_outofrange = dux_priv_errcd_outofrange,
+ dux_errcd_runerr = dux_priv_errcd_runerr,
+ dux_errcd_test = dux_priv_errcd_test,
+ dux_errcd_thrderr = dux_priv_errcd_thrderr,
+};
+
+# if dux_dbg
+# define dux_dbglog(...) dux_priv_dbglog(__VA_ARGS__)
+# else
+# define dux_dbglog(...)
+# endif
+
+dux_attr_inline dux_attr_useret inline enum dux_errcd dux_geterr() {return (enum dux_errcd)dux_priv_curerrcd;}
+dux_attr_inline dux_attr_useret inline bool dux_haserr() {return dux_priv_curerrcd == dux_priv_errcd_noerr;}
+dux_attr_inline inline void dux_reseterr() {dux_priv_curerrcd = dux_priv_errcd_noerr;}
+dux_attr_inline inline void dux_seterr( enum dux_errcd const _cd) {dux_priv_curerrcd = (enum dux_priv_errcd)_cd;}
+
+# define dux_unreach() dux_priv_unreach()
+
+# define dux_syscall dux_priv_syscall
+
+dux_attr_cold _Noreturn void dux_abrt( void);
+dux_attr_hot _Noreturn void dux_die( void);
+dux_attr_cold _Noreturn void dux_exit( enum dux_stat stat);
+dux_attr_useret struct dux_str dux_getenv( char const * envvarname);
+dux_attr_useret struct dux_str dux_getmainparam( void const * params, dux_uwrd n);
+dux_attr_useret dux_uwrd dux_getnummainparams(void const * params);
+dux_attr_cold _Noreturn void dux_qexit( enum dux_stat stat);
+ void dux_onexit( void (* fn)( enum dux_stat));
+dux_attr_cold _Noreturn void dux_thrdexit( enum dux_stat stat);
+dux_attr_cold _Noreturn void dux_trap( void);
diff --git a/include/dux/algo.d/fma.hh b/dux/include/dux/c/io.h
index 87a59e7..321f413 100644
--- a/include/dux/algo.d/fma.hh
+++ b/dux/include/dux/c/io.h
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,6 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<::dux::arith T> constexpr auto ::dux::fma(T const _x,T const _y,T const _z) noexcept -> T {
- return _x * _y + _z;
-}
+enum dux_iotyp {
+ dux_iotyp_r = dux_priv_iotyp_r,
+ dux_iotyp_rw = dux_priv_iotyp_rw,
+ dux_iotyp_w = dux_priv_iotyp_w,
+};
diff --git a/dux/include/dux/c/math.h b/dux/include/dux/c/math.h
new file mode 100644
index 0000000..784e7ba
--- /dev/null
+++ b/dux/include/dux/c/math.h
@@ -0,0 +1,60 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# define dux_num_cbrt2 (dux_priv_num_cbrt2)
+# define dux_num_e (dux_priv_num_e)
+# define dux_num_lg2 (dux_priv_num_lg2)
+# define dux_num_ln2 (dux_priv_num_ln2)
+# define dux_num_phi (dux_priv_num_phi)
+# define dux_num_pi (dux_priv_num_pi)
+# define dux_num_sqrt2 (dux_priv_num_sqrt2)
+# define dux_num_sqrt3 (dux_priv_num_sqrt3)
+
+# define dux_inf(_typ) (_Generic((_typ){0x0},double:dux_priv_infd,float:dux_priv_inff,long double:dux_priv_infld))
+
+# define dux_nan(_typ) (_Generic((_typ){0x0},double:dux_priv_nand,float:dux_priv_nanf,long double:dux_priv_nanld))
+
+# define dux_abs( _val) (dux_priv_abs( _val))
+# define dux_fma( _x, _y, _z) (dux_priv_fma( _x, _y,_z))
+# define dux_isnan(_val) (dux_priv_isnan(_val))
+# define dux_max( _val0,_val1) (dux_priv_max( _val0,_val1))
+# define dux_min( _val0,_val1) (dux_priv_min( _val0,_val1))
+
+dux_attr_const dux_attr_useret dux_uint16 dux_priv_msb16( dux_uint16 val); /* Most significant bit of val (also equal to ceil(lb(val + 1))) */
+dux_attr_const dux_attr_useret dux_uint32 dux_priv_msb32( dux_uint32 val);
+dux_attr_const dux_attr_useret dux_uint64 dux_priv_msb64( dux_uint64 val);
+dux_attr_const dux_attr_useret dux_uint8 dux_priv_msb8( dux_uint8 val);
+
+# define dux_ceil( _val) (_Generic(_val, double: dux_priv_ceild, float: dux_priv_ceilf, long double:dux_priv_ceilld)( _val))
+# define dux_exp( _base,_exp) (_Generic(_base,double: dux_priv_expd, float: dux_priv_expf, long double:dux_priv_expld)( _base,_exp))
+# define dux_floor(_val) (_Generic(_val, double: dux_priv_floord,float: dux_priv_floorf,long double:dux_priv_floorld)( _val))
+# define dux_log( _base,_val) (_Generic(_val, double: dux_priv_logd, float: dux_priv_logf, long double:dux_priv_logld)( _base,_val))
+# define dux_msb( _val) (_Generic(_val, dux_uint16:dux_priv_msb16, dux_uint32:dux_priv_msb32, dux_uint64: dux_priv_msb64, dux_uint8:dux_priv_msb8)(_val))
+# define dux_root( _exp,_val) (_Generic(_val, double: dux_priv_rootd, float: dux_priv_rootf, long double:dux_priv_rootld )( _exp, _val))
+# define dux_round(_val) (_Generic(_val, double: dux_priv_roundd,float: dux_priv_roundf,long double:dux_priv_roundld)( _val))
+# define dux_sqrt(_val) (_Generic(_val, double: dux_priv_sqrtd, float: dux_priv_sqrtf, long double:dux_priv_sqrtld)( _val))
+# define dux_trunc(_val) (_Generic(_val, double: dux_priv_truncd,float: dux_priv_truncf,long double:dux_priv_truncld)( _val))
+
+dux_attr_useret dux_uint16 dux_rnd16(void); /* Random N-bit number */
+dux_attr_useret dux_uint32 dux_rnd32(void);
+dux_attr_useret dux_uint64 dux_rnd64(void);
+dux_attr_useret dux_uint8 dux_rnd8( void);
+
+void dux_priv_swp(void * lvar,void * rvar,dux_uwrd sz);
+# define dux_swp(_lvar,_rvar) (dux_swpsz(&_lvar,&_rvar,sizeof (_lvar)))
diff --git a/include/dux/arr b/dux/include/dux/c/media.h
index ce83ad7..cc5862e 100644
--- a/include/dux/arr
+++ b/dux/include/dux/c/media.h
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,4 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_arr)
-#define dux_hdr_arr
-
-#include <dux/algo>
-#include <dux/arr.hh>
-
-#endif
+# define dux_nomedia dux_priv_nomedia
diff --git a/dux/include/dux/c/mem.h b/dux/include/dux/c/mem.h
new file mode 100644
index 0000000..012df35
--- /dev/null
+++ b/dux/include/dux/c/mem.h
@@ -0,0 +1,23 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+dux_attr_useret void * dux_alloc( dux_uwrd sz);
+dux_attr_useret void * dux_realloc(void const * ptr,dux_uwrd newsz);
+
+# define dux_free dux_priv_free
diff --git a/include/dux/algo.d/isnan.hh b/dux/include/dux/c/seq.h
index 26825e6..39256c3 100644
--- a/include/dux/algo.d/isnan.hh
+++ b/dux/include/dux/c/seq.h
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,6 +17,7 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<::dux::arith T> constexpr auto ::dux::isnan(T const _val) noexcept -> bool {
- return _val != _val;
-}
+# define dux_cpy dux_priv_cpy
+# define dux_dup dux_priv_dup
+# define dux_fill dux_priv_fill
+# define dux_plot dux_priv_plot
diff --git a/dux/include/dux/c/sig.h b/dux/include/dux/c/sig.h
new file mode 100644
index 0000000..63e8b1a
--- /dev/null
+++ b/dux/include/dux/c/sig.h
@@ -0,0 +1,60 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+enum dux_sig {
+ dux_sig_abrt = dux_priv_sig_abrt,
+ dux_sig_alrm = dux_priv_sig_alrm,
+ dux_sig_bus = dux_priv_sig_bus,
+ dux_sig_chld = dux_priv_sig_chld,
+ dux_sig_cont = dux_priv_sig_cont,
+ dux_sig_fpe = dux_priv_sig_fpe,
+ dux_sig_hup = dux_priv_sig_hup,
+ dux_sig_ill = dux_priv_sig_ill,
+ dux_sig_io = dux_priv_sig_io,
+ dux_sig_iot = dux_priv_sig_iot,
+ dux_sig_intr = dux_priv_sig_intr,
+ dux_sig_kill = dux_priv_sig_kill,
+ dux_sig_pipe = dux_priv_sig_pipe,
+ dux_sig_poll = dux_priv_sig_poll,
+ dux_sig_prof = dux_priv_sig_prof,
+ dux_sig_pwr = dux_priv_sig_pwr,
+ dux_sig_quit = dux_priv_sig_quit,
+ dux_sig_segv = dux_priv_sig_segv,
+ dux_sig_stop = dux_priv_sig_stop,
+ dux_sig_sys = dux_priv_sig_sys,
+ dux_sig_term = dux_priv_sig_term,
+ dux_sig_trap = dux_priv_sig_trap,
+ dux_sig_tstp = dux_priv_sig_tstp,
+ dux_sig_ttin = dux_priv_sig_ttin,
+ dux_sig_ttou = dux_priv_sig_ttou,
+ dux_sig_urg = dux_priv_sig_urg,
+ dux_sig_usr1 = dux_priv_sig_usr1,
+ dux_sig_usr2 = dux_priv_sig_usr2,
+ dux_sig_vtalrm = dux_priv_sig_vtalrm,
+ dux_sig_winch = dux_priv_sig_winch,
+ dux_sig_xcpu = dux_priv_sig_xcpu,
+ dux_sig_xfsz = dux_priv_sig_xfsz,
+};
+# define dux_numsig dux_priv_numsig
+
+typedef bool (* dux_sighandl)(enum dux_sig sig);
+# define dux_dflsighandl dux_priv_dflcsighandl
+
+void dux_raise( enum dux_sig sig);
+void dux_setsighandl(enum dux_sig sig,dux_sighandl handl);
diff --git a/dux/include/dux/c/str.h b/dux/include/dux/c/str.h
new file mode 100644
index 0000000..368d0c7
--- /dev/null
+++ b/dux/include/dux/c/str.h
@@ -0,0 +1,47 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+dux_attr_const dux_attr_useret bool dux_isalnum( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_isalpha( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_iscntrl( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_isdigit( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_islower( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_ispunct( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_isspace( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_issurro( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_isupper( dux_chr32 chr);
+dux_attr_const dux_attr_useret bool dux_isxdigit(dux_chr32 chr);
+
+dux_attr_const dux_attr_useret char const * dux_uniblk(dux_chr32 chr);
+dux_attr_const dux_attr_useret char const * dux_uninm( dux_chr32 chr);
+
+dux_attr_useret dux_chr32 const * dux_u16tou32(dux_chr16 const * u16);
+dux_attr_useret dux_chr8 const * dux_u16tou8( dux_chr16 const * u16);
+dux_attr_useret dux_chr16 const * dux_u32tou16(dux_chr32 const * u32);
+dux_attr_useret dux_chr8 const * dux_u32tou8( dux_chr32 const * u32);
+dux_attr_useret dux_chr16 const * dux_u8tou16( dux_chr8 const * u8);
+dux_attr_useret dux_chr32 const * dux_u8tou32( dux_chr8 const * u8);
+
+dux_attr_useret dux_uwrd dux_fndchr(char const * str, int chr);
+dux_attr_useret dux_uwrd dux_fndstr(char const * str, char const * substr);
+dux_attr_useret dux_sint8 dux_strcmp(char const * lstr,char const * rstr);
+ void dux_strcpy(char const * src, char * dest);
+dux_attr_useret struct dux_str dux_strdup(char const * str);
+dux_attr_useret bool dux_streq(char const * lstr,char const * rstr);
+dux_attr_useret dux_uwrd dux_strlen(char const * lstr);
diff --git a/dux/include/dux/c/thrd.h b/dux/include/dux/c/thrd.h
new file mode 100644
index 0000000..86f5c17
--- /dev/null
+++ b/dux/include/dux/c/thrd.h
@@ -0,0 +1,18 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
diff --git a/include/dux/algo b/dux/include/dux/c/time.h
index 4358784..6dcfa4c 100644
--- a/include/dux/algo
+++ b/dux/include/dux/c/time.h
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,5 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_algo)
-#define dux_hdr_algo
-
-#include <dux/base>
-#include <dux/algo.hh>
-
-#endif
+dux_attr_useret dux_sint64 dux_gettime(void);
+ void dux_sleep( dux_uint64 sec);
diff --git a/dux/include/dux/cxx/base.hh b/dux/include/dux/cxx/base.hh
new file mode 100644
index 0000000..bbf2176
--- /dev/null
+++ b/dux/include/dux/cxx/base.hh
@@ -0,0 +1,402 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ constexpr auto dbg {dux_dbg};
+ constexpr auto ver {dux_priv_ver};
+}
+
+namespace dux {
+ using uint8 = dux_priv_uint8;
+ using sint8 = dux_priv_sint8;
+ using uint16 = dux_priv_uint16;
+ using sint16 = dux_priv_sint16;
+ using uint32 = dux_priv_uint32;
+ using sint32 = dux_priv_sint32;
+ using uint64 = dux_priv_uint64;
+ using sint64 = dux_priv_sint64;
+ using uwrd = dux_priv_uwrd;
+ using swrd = dux_priv_swrd;
+
+ using nullptrtyp = decltype (nullptr);
+}
+
+namespace dux { /* Clang (13.0.1) complains about multiple definitions here. Clang is retarded. */
+ template<typename T> constexpr auto maxval {T {0x0}};
+ template<> constexpr auto maxval<bool> {static_cast<bool>( true)};
+ template<> constexpr auto maxval<char> {static_cast<char>( dux_chrmax)};
+ template<> constexpr auto maxval<char16_t> {static_cast<char16_t>( dux_chr16max)};
+ template<> constexpr auto maxval<char32_t> {static_cast<char32_t>( dux_chr32max)};
+ template<> constexpr auto maxval<char8_t> {static_cast<char8_t>( dux_chr8max)};
+ template<> constexpr auto maxval<double> {static_cast<double>( dux_dblmax)};
+ template<> constexpr auto maxval<int> {static_cast<int>( dux_intmax)};
+ template<> constexpr auto maxval<long> {static_cast<long>( dux_lngmax)};
+ template<> constexpr auto maxval<long double> {static_cast<long double>( dux_ldblmax)};
+ template<> constexpr auto maxval<long long> {static_cast<long long>( dux_llngmax)};
+ template<> constexpr auto maxval<::dux::nullptrtyp> { nullptr};
+ template<> constexpr auto maxval<short> {static_cast<short>( dux_shrtmax)};
+ template<> constexpr auto maxval<signed char> {static_cast<signed char>( dux_schrmax)};
+ template<> constexpr auto maxval<unsigned char> {static_cast<unsigned char>( dux_uchrmax)};
+ template<> constexpr auto maxval<unsigned int> {static_cast<unsigned int>( dux_uintmax)};
+ template<> constexpr auto maxval<unsigned long> {static_cast<unsigned long>( dux_ulngmax)};
+ template<> constexpr auto maxval<unsigned long long> {static_cast<unsigned long long>(dux_ullngmax)};
+ template<> constexpr auto maxval<unsigned short> {static_cast<unsigned short>( dux_ushrtmax)};
+ template<> constexpr auto maxval<wchar_t> {static_cast<wchar_t>( dux_wchrmax)};
+}
+
+namespace dux::priv {
+ template<typename T,typename T0> struct issame {constexpr static auto val {false};};
+ template<typename T> struct issame<T,T> {constexpr static auto val {true};};
+}
+namespace dux {
+ template<typename T,typename T0> constexpr auto issame {::dux::priv::issame<T,T0>::val};
+}
+# if defined(dux_lang_cxx23)
+static_assert(::dux::issame<decltype(0x0uz),::dux::uwrd>);
+# endif
+
+namespace dux::priv {
+ template<typename T> struct isptrtyp {constexpr static auto val {false};};
+ template<typename T> struct isptrtyp<T *> {constexpr static auto val {true};};
+}
+namespace dux {
+ template<typename T> constexpr auto isptrtyp {::dux::priv::isptrtyp<T>::val};
+}
+
+namespace dux {
+ template<typename T> constexpr auto ischrtyp {::dux::issame<T,char> || ::dux::issame<T,char16_t> || ::dux::issame<T,char32_t> || ::dux::issame<T,char8_t> || ::dux::issame<T,wchar_t>};
+ template<typename T,typename T0> constexpr auto iscnvto {requires {static_cast<T0>(T {});}};
+ template<typename T> constexpr auto isflttyp {::dux::issame<T,double> || ::dux::issame<T,float> || ::dux::issame<T,long double>};
+ template<typename T> constexpr auto issinttyp {::dux::issame<T,int> || ::dux::issame<T,long> || ::dux::issame<T,long long> || ::dux::issame<T,short> || ::dux::issame<T,signed char>};
+ template<typename T> constexpr auto isuinttyp {::dux::issame<T,unsigned char> || ::dux::issame<T,unsigned int> || ::dux::issame<T,unsigned long> || ::dux::issame<T,unsigned long long> || ::dux::issame<T,unsigned short>};
+
+ template<typename T> constexpr auto isinttyp {::dux::issinttyp<T> || ::dux::isuinttyp<T>};
+
+ template<typename T> constexpr auto isarithtyp {::dux::isflttyp<T> || ::dux::isinttyp<T>};
+}
+
+namespace dux {
+ template<typename T> concept arithtyp = ::dux::isarithtyp<T>;
+ template<typename T,typename T0> concept cnvto = ::dux::iscnvto<T,T0>;
+ template<typename T> concept chrtyp = ::dux::ischrtyp<T>;
+ template<typename T> concept flttyp = ::dux::isflttyp<T>;
+ template<typename T> concept inttyp = ::dux::isinttyp<T>;
+ template<typename T> concept ptrtyp = ::dux::isptrtyp<T>;
+ template<typename T> concept sinttyp = ::dux::issinttyp<T>;
+ template<typename T> concept uinttyp = ::dux::isuinttyp<T>;
+
+}
+
+namespace dux::priv {
+ template<typename T> struct remconst {using t = T;};
+ template<typename T> struct remconst<T const> {using t = T;};
+
+ template<typename T> struct remrestr {using t = T;};
+ template<typename T> struct remrestr<T * restrict> {using t = T *;};
+
+ template<typename T> struct remref {using t = T;};
+ template<typename T> struct remref<T &> {using t = T;};
+ template<typename T> struct remref<T const &> {using t = T;};
+ template<typename T> struct remref<T &&> {using t = T;};
+ template<typename T> struct remref<T const &&> {using t = T;};
+}
+namespace dux {
+ template<typename T> using remconst = typename ::dux::priv::remconst<T>::t;
+
+ template<typename T> using remrestr = typename ::dux::priv::remrestr<T>::t;
+
+ template<typename T> using remcr = typename ::dux::remrestr<::dux::remconst<T>>;
+
+ template<typename T> using remref = typename ::dux::priv::remref<T>::t;
+}
+
+namespace dux::priv {
+ template<typename T> struct sign {using t = T;};
+ template<> struct sign<char> {using t = signed char;};
+ template<> struct sign<unsigned int> {using t = int;};
+ template<> struct sign<unsigned char> {using t = signed char;};
+ template<> struct sign<unsigned long> {using t = long;};
+ template<> struct sign<unsigned long long> {using t = long long;};
+
+ template<typename T> struct unsign {using t = T;};
+ template<> struct unsign<char> {using t = unsigned char;};
+ template<> struct unsign<int> {using t = unsigned int;};
+ template<> struct unsign<long> {using t = unsigned long;};
+ template<> struct unsign<long long> {using t = unsigned long long;};
+ template<> struct unsign<signed char> {using t = unsigned char;};
+}
+namespace dux {
+ template<::dux::inttyp T> using sign = typename ::dux::priv::sign<T>::t;
+ template<::dux::inttyp T> using unsign = typename ::dux::priv::unsign<T>::t;
+}
+
+namespace dux {
+ template<typename T> inline auto getbit(T const & _val,::dux::uwrd const _pos) noexcept -> bool {
+ auto const bit {[&_pos,&_val] {
+ auto const getbit {[&_pos]<typename T0>(T0 const _val) {return static_cast<bool>(_val >> _pos & T {0x1});}};
+ if constexpr (sizeof (T) > sizeof (::dux::uwrd)) {
+ auto const ptr {reinterpret_cast<::dux::uint8 const *>(&_val)};
+ auto const byte {ptr[_pos % dux_uwrdl(0x8)]};
+ return getbit(byte);
+ }
+ else {return getbit(_val);}
+ }()};
+ return bit;
+ }
+}
+
+namespace dux {
+ enum class stat : ::dux::uint8 {
+ badop = static_cast<::dux::uint8>(::dux_priv_stat_badop),
+ err = static_cast<::dux::uint8>(::dux_priv_stat_err),
+ illop = static_cast<::dux::uint8>(::dux_priv_stat_illop),
+ max = static_cast<::dux::uint8>(::dux_priv_stat_max),
+ ok = static_cast<::dux::uint8>(::dux_priv_stat_ok),
+ };
+}
+
+namespace dux {
+ enum class errcd : ::dux::uint8 {
+ noerr = ::dux_priv_errcd_noerr,
+ again = ::dux_priv_errcd_again,
+ badacs = ::dux_priv_errcd_badacs,
+ badaddr = ::dux_priv_errcd_badaddr,
+ badalloc = ::dux_priv_errcd_badalloc,
+ badio = ::dux_priv_errcd_badio,
+ badperms = ::dux_priv_errcd_badperms,
+ badpipe = ::dux_priv_errcd_badpipe,
+ badseq = ::dux_priv_errcd_badseq,
+ badstr = ::dux_priv_errcd_badstr,
+ badutf = ::dux_priv_errcd_badutf,
+ bigfile = ::dux_priv_errcd_bigfile,
+ illcallseq = ::dux_priv_errcd_illcallseq,
+ illparam = ::dux_priv_errcd_illparam,
+ illsz = ::dux_priv_errcd_illsz,
+ matherr = ::dux_priv_errcd_matherr,
+ nodir = ::dux_priv_errcd_nodir,
+ nofile = ::dux_priv_errcd_nofile,
+ noimpl = ::dux_priv_errcd_noimpl,
+ nospc = ::dux_priv_errcd_nospc,
+ outofrange = ::dux_priv_errcd_outofrange,
+ runerr = ::dux_priv_errcd_runerr,
+ test = ::dux_priv_errcd_test,
+ thrderr = ::dux_priv_errcd_thrderr,
+ };
+}
+
+namespace dux {
+ using str = ::dux_priv_str;
+}
+namespace dux::priv {
+ template<::dux::uwrd N> [[nodiscard]] consteval auto strlittoduxstr(char const (& _strlit)[N]) noexcept -> ::dux::str {
+ ::dux::str str;
+ str.ptr = _strlit;
+ str.sz = N - dux_uwrdl(0x1);
+ return str;
+ }
+}
+
+namespace dux {
+ template<::dux::inttyp T,T... Ints> class intseq {
+ public:
+ constexpr static auto sz {dux_uwrdl(0x1) + sizeof...(Ints)};
+ };
+ template<::dux::inttyp T,T N> using mkintseq =
+# if dux_hasbuiltin(__make_integer_seq)
+ __make_integer_seq<::dux::intseq,T,N>;
+# elif dux_hasbuiltin(__integer_pack)
+ ::dux::intseq<T,__integer_pack(N)...>;
+# else
+# error Unable to implement (::dux::mkintseq)!
+# endif
+}
+
+namespace dux {
+ template<typename T,typename... Ts> class tup;
+}
+namespace dux::priv {
+ template<::dux::uwrd N,typename T> class tupbase {
+ public:
+ [[nodiscard]] constexpr tupbase() noexcept = default;
+ [[nodiscard]] constexpr tupbase(T const & _val) noexcept {this->_val = _val;}
+ [[nodiscard]] constexpr auto get() const noexcept -> T const & {return this->_val;}
+ private:
+ T _val;
+ };
+ template<::dux::uwrd N,typename... Ts> class tuprecurbase {};
+ template<::dux::uwrd N,typename T, typename... Ts> class tuprecurbase<N,T,Ts...> : public ::dux::priv::tupbase<N,T>,public ::dux::priv::tuprecurbase<N + dux_uwrdl(0x1),Ts...> {
+ public:
+ [[nodiscard]] constexpr tuprecurbase() noexcept = default;
+ template<typename T0,typename... Ts0> [[nodiscard]] constexpr tuprecurbase(T0 const & _val,Ts0 const &... _vals) noexcept : ::dux::priv::tupbase<N,T0>(_val), ::dux::priv::tuprecurbase<N + dux_uwrdl(0x1),Ts...>(_vals...) {}
+ };
+ template<::dux::uwrd N,typename T,typename... Ts> class tupgettyp {
+ public:
+ using typ = typename ::dux::priv::tupgettyp<N - dux_uwrdl(0x1),Ts...>::typ;
+ };
+ template<typename T,typename... Ts> class tupgettyp<dux_uwrdl(0x0),T,Ts...> {
+ public:
+ using typ = T;
+ };
+ template<typename Fn,typename... Ts,::dux::uwrd... N> [[nodiscard]] constexpr auto tupapply(Fn && _fn,::dux::tup<Ts...> const & _tup,::dux::intseq<::dux::uwrd,N...>) -> decltype (auto) {
+ return _fn(_tup.template get<N>()...);
+ }
+}
+namespace dux {
+ template<typename T,typename... Ts> class tup : public ::dux::priv::tuprecurbase<dux_uwrdl(0x0),T,Ts...> {
+ public:
+ template<typename Fn> [[nodiscard]] constexpr auto apply(Fn const & _fn) const -> decltype (auto) {return ::dux::priv::tupapply(_fn,*this,dux::mkintseq<::dux::uwrd,dux_uwrdl(0x1) + sizeof...(Ts)> {});}
+ template<::dux::uwrd N> [[nodiscard]] constexpr auto get() const noexcept -> auto {return static_cast<::dux::priv::tupbase<N,typename ::dux::priv::tupgettyp<N,T,Ts...>::typ> const *>(this)->get();}
+ [[nodiscard]] constexpr tup() noexcept = default;
+ [[nodiscard]] constexpr tup( T const & _val,Ts const &... _vals) noexcept : ::dux::priv::tuprecurbase<dux_uwrdl(0x0),T,Ts...>(_val,_vals...) {}
+
+ constexpr static auto sz {dux_uwrdl(0x1) + sizeof...(Ts)};
+ };
+}
+
+namespace dux {
+ class mainparams {
+ public:
+ [[nodiscard]] mainparams() noexcept;
+ ~mainparams() noexcept;
+
+ auto fromstd(int const argc,char const * const * const argv) noexcept -> void;
+
+ [[nodiscard]] auto num() const noexcept -> ::dux::uwrd;
+ [[nodiscard]] auto param(::dux::uwrd const _n) const noexcept -> ::dux::str;
+ private:
+ bool _alloc;
+ ::dux::str * _params;
+ ::dux::uwrd _num;
+ };
+}
+
+namespace dux {
+ template<typename T> constexpr auto fwd(T & _ref) noexcept -> ::dux::remref<T> && {return static_cast<::dux::remref<T> &&>(_ref);}
+}
+
+namespace dux {
+ [[nodiscard]] constexpr auto errcdnm( ::dux::errcd const cd) noexcept -> ::dux::str;
+ [[nodiscard]] dux_attr_inline inline auto haserr() noexcept -> bool {return ::dux_priv_curerrcd != ::dux_priv_errcd_noerr;}
+ dux_attr_inline inline auto reseterr() noexcept -> void {::dux_priv_curerrcd = ::dux_priv_errcd_noerr;}
+ dux_attr_inline inline auto seterr( ::dux::errcd const _cd) noexcept -> void {::dux_priv_curerrcd = static_cast<::dux_priv_errcd>(_cd);}
+
+ [[nodiscard]] dux_attr_inline inline auto geterr() noexcept -> ::dux::errcd {
+ auto const errcd {static_cast<::dux::errcd>(::dux_priv_curerrcd)};
+ ::dux::reseterr();
+ return errcd;
+ }
+}
+
+namespace dux {
+ template<typename... Ts> dux_attr_hot auto syscall(::dux::uwrd _syscallid,Ts const... _args) noexcept -> ::dux::uwrd {return ::dux_priv_syscall(_syscallid,_args...);}
+}
+
+namespace dux::priv {
+ class qexit {};
+ class thrdexit {};
+}
+namespace dux {
+ constexpr ::dux::priv::qexit qexit;
+ constexpr ::dux::priv::thrdexit thrdexit;
+
+ dux_attr_cold [[noreturn]] auto exit(::dux::stat stat) noexcept -> void;
+ dux_attr_cold [[noreturn]] auto exit(::dux::stat stat,::dux::priv::qexit) noexcept -> void;
+ dux_attr_cold [[noreturn]] auto exit(::dux::stat stat,::dux::priv::thrdexit) noexcept -> void;
+}
+
+namespace dux::priv {
+ using onexitfn = auto (*)(::dux::stat) -> void;
+}
+namespace dux {
+ auto onexit(::dux::priv::onexitfn fn) noexcept -> void;
+}
+
+namespace dux {
+ dux_attr_cold [[noreturn]] auto abrt() noexcept -> void;
+ dux_attr_cold [[noreturn]] auto trap() noexcept -> void;
+
+ dux_attr_cold dux_attr_inline [[noreturn]] inline auto unreach(char const * const restrict _file = dux_priv_builtinfile(),long const _line = dux_priv_builtinline()) noexcept -> ::dux::uwrd {
+ if constexpr (::dux::dbg) {::dux_priv_dbgunreach(_file,_line);}
+ else {dux_priv_unreach();}
+ }
+}
+
+namespace dux {
+ [[nodiscard]] auto getenv( char const * envvarname) noexcept -> ::dux::str;
+}
+
+constexpr auto ::dux::errcdnm(::dux::errcd const _cd) noexcept -> ::dux::str {
+ switch (_cd) {
+ case ::dux::errcd::again:
+ return ::dux::priv::strlittoduxstr("AGAIN");
+ case ::dux::errcd::badacs:
+ return ::dux::priv::strlittoduxstr("BADACS");
+ case ::dux::errcd::badaddr:
+ return ::dux::priv::strlittoduxstr("BADADDR");
+ case ::dux::errcd::badalloc:
+ return ::dux::priv::strlittoduxstr("BADALLOC");
+ case ::dux::errcd::badio:
+ return ::dux::priv::strlittoduxstr("BADIO");
+ case ::dux::errcd::badperms:
+ return ::dux::priv::strlittoduxstr("BADPERMS");
+ case ::dux::errcd::badpipe:
+ return ::dux::priv::strlittoduxstr("BADPIPE");
+ case ::dux::errcd::badseq:
+ return ::dux::priv::strlittoduxstr("BADSEQ");
+ case ::dux::errcd::badstr:
+ return ::dux::priv::strlittoduxstr("BADSTR");
+ case ::dux::errcd::badutf:
+ return ::dux::priv::strlittoduxstr("BADUTF");
+ case ::dux::errcd::bigfile:
+ return ::dux::priv::strlittoduxstr("BIGFILE");
+ case ::dux::errcd::illcallseq:
+ return ::dux::priv::strlittoduxstr("ILLCALLSEQ");
+ case ::dux::errcd::illparam:
+ return ::dux::priv::strlittoduxstr("ILLPARAM");
+ case ::dux::errcd::illsz:
+ return ::dux::priv::strlittoduxstr("ILLSZ");
+ case ::dux::errcd::matherr:
+ return ::dux::priv::strlittoduxstr("MATHERR");
+ case ::dux::errcd::nodir:
+ return ::dux::priv::strlittoduxstr("NODIR");
+ case ::dux::errcd::noerr:
+ return ::dux::priv::strlittoduxstr("NOERR");
+ case ::dux::errcd::nofile:
+ return ::dux::priv::strlittoduxstr("NOFILE");
+ case ::dux::errcd::noimpl:
+ return ::dux::priv::strlittoduxstr("NOIMPL");
+ case ::dux::errcd::nospc:
+ return ::dux::priv::strlittoduxstr("NOSPC");
+ case ::dux::errcd::outofrange:
+ return ::dux::priv::strlittoduxstr("OUTOFRANGE");
+ case ::dux::errcd::runerr:
+ return ::dux::priv::strlittoduxstr("RUNERR");
+ case ::dux::errcd::test:
+ return ::dux::priv::strlittoduxstr("TEST");
+ case ::dux::errcd::thrderr:
+ return ::dux::priv::strlittoduxstr("THRDERR");
+ }
+ ::dux::unreach();
+}
+
+namespace dux {
+ template<typename... Ts> dux_attr_hot constexpr auto dbglog(char const * const restrict _msg,Ts... _vals) noexcept -> void {
+ if constexpr (::dux::dbg) {dux_priv_ifnotconsteval {::dux_priv_dbglog(_msg,_vals...);}}
+ }
+}
diff --git a/include/dux/algo.d/abs.hh b/dux/include/dux/cxx/io.hh
index b713c90..333504f 100644
--- a/include/dux/algo.d/abs.hh
+++ b/dux/include/dux/cxx/io.hh
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,14 +17,10 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<::dux::arith T> constexpr auto ::dux::abs(T const _val) noexcept -> T {
- if constexpr (::dux::isuint<T>) {
- return _val;
- }
- else {
- if (_val < T{0x0}) {
- return -_val;
- }
- return _val;
- }
+namespace dux {
+ enum iotyp : ::dux::uint8 {
+ r = static_cast<::dux::uint8>(::dux_priv_iotyp_r),
+ rw = static_cast<::dux::uint8>(::dux_priv_iotyp_rw),
+ w = static_cast<::dux::uint8>(::dux_priv_iotyp_w),
+ };
}
diff --git a/dux/include/dux/cxx/math.hh b/dux/include/dux/cxx/math.hh
new file mode 100644
index 0000000..a0b885b
--- /dev/null
+++ b/dux/include/dux/cxx/math.hh
@@ -0,0 +1,141 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux::num {
+ constexpr auto e {dux_priv_num_e};
+ constexpr auto phi {dux_priv_num_phi};
+ constexpr auto pi {dux_priv_num_pi};
+}
+
+namespace dux::priv {
+ template<::dux::arithtyp T> constexpr auto inf {::dux::maxval<T>};
+ template<> constexpr auto inf<double> {dux_priv_infd};
+ template<> constexpr auto inf<float> {dux_priv_inff};
+ template<> constexpr auto inf<long double> {dux_priv_infld};
+}
+namespace dux {
+ template<::dux::arithtyp T> constexpr auto inf {::dux::priv::inf<T>};
+}
+
+namespace dux::priv {
+ template<::dux::arithtyp T> constexpr auto nan {T {0x0}};
+ template<> constexpr auto nan<double> {dux_priv_nand};
+ template<> constexpr auto nan<float> {dux_priv_nanf};
+ template<> constexpr auto nan<long double> {dux_priv_nanld};
+}
+namespace dux {
+ template<::dux::arithtyp T> constexpr auto nan {::dux::priv::nan<T>};
+}
+
+namespace dux {
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto abs( T const _val) noexcept -> T {return dux_priv_abs(_val);}
+ template<::dux::uinttyp T> dux_attr_const [[nodiscard]] constexpr auto abs( T const _val) noexcept -> T {return _val;}
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto fma( T const _x, T const _y, T const _z) noexcept -> T {return dux_priv_fma(_x,_y,_z);}
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto isinf(T const _val) noexcept -> bool {return _val > ::dux::inf<T>;}
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto isnan(T const _val) noexcept -> bool {return dux_priv_isnan(_val);}
+ template<typename T> dux_attr_const [[nodiscard]] constexpr auto max( T const & _lval,T const & _rval) noexcept -> T const & {return dux_priv_max(_lval,_rval);}
+ template<typename T> dux_attr_const [[nodiscard]] constexpr auto min( T const & _lval,T const & _rval) noexcept -> T const & {return dux_priv_min(_lval,_rval);}
+
+ template<::dux::inttyp T> dux_attr_const [[nodiscard]] constexpr auto fac(T const _val) noexcept -> auto {
+ using T0 = ::dux::unsign<T>;
+ if constexpr (::dux::issinttyp<T>) {if (_val < T {0x0}) [[unlikely]] {return T0 {0x0};}}
+ auto const val {[&_val] {
+ if constexpr (::dux::issinttyp<T>) {return static_cast<T0>(_val);}
+ else {return _val;}
+ }()};
+ auto res {T0 {0x1}};
+ for (auto n {T0 {0x1}};n <= _val;++n) {res *= n;}
+ return res;
+ }
+
+ template<::dux::inttyp T> dux_attr_const [[nodiscard]] constexpr auto msb(T const _val) noexcept -> auto {
+ using T0 = ::dux::unsign<T>;
+ if constexpr (::dux::issinttyp<T>) {if (_val < T {0x0}) [[unlikely]] {return - T0 {0x1};}}
+ if (_val == T {0x0}) [[unlikely]] {return T0 {0x0};}
+ auto val {static_cast<T0>(_val)};
+ auto bit {T0 {0x0}};
+ while (val >>= T0 {0x1}) {++bit;}
+ return static_cast<T0>(T0 {0x1} << bit);
+ }
+
+ template<typename T,typename Fn> constexpr auto plot(T * const restrict _list,::dux::uwrd const _sz,Fn const & _fn) noexcept -> void {
+ using fntyp = auto (*)(::dux::uwrd n) -> T;
+ static_assert(::dux::iscnvto<Fn,fntyp>,"Function must be of type (auto (*)(::dux::uwrd) -> T)!");
+ auto const fn {static_cast<fntyp>(_fn)};
+ for (auto n {dux_uwrdl(0x0)};n < _sz;++n) {_list[n] = fn(n);}
+ }
+
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto pow(T const _base,T const _exp) noexcept -> T {
+ if (::dux::abs(_base) <= T {0x1}) [[unlikely]] {return _base;}
+ auto res = _base;
+ for (auto iter = T {0x1};iter < _exp;iter += T {0x1}) {res *= _base;}
+ return res;
+ }
+
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto sqrt(T const _val) noexcept -> T {
+ dux_priv_ifconsteval {return ::dux_priv_sqrtf(_val);}
+ {
+ if (_val < T {0x0}) [[unlikely]] {return ::dux::nan<T>;}
+ if (_val == T {0x0}) [[unlikely]] {return T {0x0};}
+ return _val;
+ }
+ }
+
+ template<::dux::arithtyp T> constexpr auto swp(T & _lvar,T & _rvar) noexcept -> void {
+ T const mvar = _lvar;
+ _lvar = _rvar;
+ _rvar = mvar;
+ }
+}
+
+namespace dux {
+ template<::dux::arithtyp T> dux_attr_const [[nodiscard]] constexpr auto isprime(T const _val) noexcept -> bool {
+ if (_val < T {0x2}) [[unlikely]] {return false;}
+ if (_val == T {0x2}) [[unlikely]] {return true;}
+ if (_val % T {0x2} == T {0x0}) {return false;}
+ for (auto n {T {0x3}};n < _val / T {0x2};n += T {0x2}) {if (_val % n == T {0x0}) {return false;}}
+ return true;
+ }
+}
+
+namespace dux {
+ template<::dux::arithtyp T> [[nodiscard]] consteval auto cabs( T const _val) noexcept -> T {return ::dux::abs(_val);}
+ template<::dux::inttyp T> [[nodiscard]] consteval auto cfac( T const _val) noexcept -> T {return ::dux::fac(_val);}
+ template<::dux::arithtyp T> [[nodiscard]] consteval auto cfma( T const _x, T const _y, T const _z) noexcept -> T {return ::dux::fma(_x,_y,_z);}
+ template<typename T> [[nodiscard]] consteval auto cmax( T const & _lval,T const & _rval) noexcept -> T const & {return ::dux::max(_lval,_rval);}
+ template<typename T> [[nodiscard]] consteval auto cmin( T const & _lval,T const & _rval) noexcept -> T const & {return ::dux::min(_lval,_rval);}
+ template<::dux::arithtyp T> [[nodiscard]] consteval auto cpow( T const _base,T _exp) noexcept -> T {return ::dux::pow(_base,_exp);}
+ template<::dux::arithtyp T> [[nodiscard]] consteval auto csqrt(T const _val) noexcept -> T {return ::dux::sqrt(_val);}
+}
+
+namespace dux::priv {
+ auto freernd(::dux::uint8 * ptr) noexcept -> void;
+ auto rnd( ::dux::uint8 * buf,::dux::uwrd sz) noexcept -> void;
+}
+namespace dux {
+ template<::dux::arithtyp T> inline auto rnd() noexcept -> T { /* TO-DO: Implement a compile time (pseudo) random number generator. Use __TIME__? */
+ if constexpr (::dux::isflttyp<T>) {return ::dux::nan<T>;} /* TO-DO: Implement a working random number generator for floating-point types. */
+ else {
+ constexpr auto sz {sizeof (T)};
+ ::dux::uint8 buf[sz];
+ ::dux::priv::rnd(buf,sz);
+ return *reinterpret_cast<T *>(buf);
+ }
+ }
+}
diff --git a/dux/include/dux/cxx/media.hh b/dux/include/dux/cxx/media.hh
new file mode 100644
index 0000000..a80db67
--- /dev/null
+++ b/dux/include/dux/cxx/media.hh
@@ -0,0 +1,22 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ auto & nomedia {::dux_priv_nomedia};
+}
diff --git a/dux/include/dux/cxx/mem.hh b/dux/include/dux/cxx/mem.hh
new file mode 100644
index 0000000..28b299c
--- /dev/null
+++ b/dux/include/dux/cxx/mem.hh
@@ -0,0 +1,92 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ template<typename T> constexpr auto alloc() noexcept -> T * {
+ static_assert(!::dux::issame<T,void>,"You may not allocate void objects!");
+ dux_priv_ifconsteval {
+ try {return ::new T;}
+ catch (...) {
+ ::dux::seterr(::dux::errcd::badalloc);
+ return nullptr;
+ }
+ }
+ else {
+ auto const ptr {static_cast<T *>(::dux_priv_alloc(sizeof (T),alignof (T)))}; /* This is not UB, as the pointer will be correctly alligned to any type. */
+ *ptr = T {};
+ return ptr;
+ }
+ }
+ template<typename T> constexpr auto alloc(::dux::uwrd const _sz) noexcept -> T * {
+ static_assert(!::dux::issame<T,void>,"You may not allocate void objects!");
+ if (_sz == dux_uwrdl(0x0)) [[unlikely]] {return nullptr;}
+ dux_priv_ifconsteval {
+ try {return ::new T[_sz];}
+ catch (...) {
+ ::dux::seterr(::dux::errcd::badalloc);
+ return nullptr;
+ }
+ }
+ else {
+ auto const olderr {::dux::geterr()};
+ ::dux::reseterr();
+ auto const ptr {static_cast<T *>(::dux_priv_alloc(_sz * sizeof (T),alignof (T)))};
+ if (::dux::haserr()) [[unlikely]] {return nullptr;}
+ ::dux::seterr(olderr);
+ if (_sz > dux_uwrdl(0x1)) [[likely]] {for (auto tmp {ptr};tmp < ptr + _sz;++tmp) {*tmp = T {};}}
+ return ptr;
+ }
+ }
+
+ [[noreturn]] auto free(::dux::nullptrtyp) noexcept -> void;
+ template<typename T> constexpr auto free(T * const restrict _ptr) noexcept -> void { /* TO-DO: Call destructors. Cannot be implemented before getallocsz. */
+ static_assert(!::dux::issame<T,void>,"You may not free void objects!");
+ dux_priv_ifconsteval {::delete[] _ptr;}
+ else {::dux_priv_free(_ptr);}
+ }
+
+ template<typename T> constexpr auto renew(T * const restrict _ptr,::dux::uwrd const _newsz) -> T * {
+ auto * const restrict newptr = ::new T[_newsz];
+ auto const oldsz {::__builtin_object_size(_ptr,0x0)};
+ ::dux::cpy(_ptr,::dux::min(oldsz,_newsz),newptr);
+ ::delete[] _ptr;
+ return newptr;
+ }
+}
+
+namespace dux::priv {
+ auto getallocsz(void * ptr) noexcept -> ::dux::uwrd;
+}
+namespace dux {
+ template<typename T> constexpr auto getallocsz(T * const restrict _ptr) noexcept -> ::dux::uwrd {
+ dux_priv_ifconsteval {return ::__builtin_object_size(_ptr,0x0);}
+ else {return ::dux::priv::getallocsz(_ptr);}
+ }
+}
+
+namespace dux::priv {
+ auto realloc(void * ptr,::dux::uwrd newsz) noexcept -> void *;
+}
+namespace dux {
+ template<typename T> constexpr auto realloc(T * const restrict _ptr,::dux::uwrd const _newsz) noexcept -> T * {
+ static_assert(!::dux::issame<T,void>,"You may not allocate void objects!");
+ dux_priv_ifconsteval {return ::dux::renew(_ptr,_newsz);}
+ else {return static_cast<T *>(::dux::priv::realloc(_ptr,_newsz * sizeof (T)));}
+ }
+}
diff --git a/dux/include/dux/cxx/seq.hh b/dux/include/dux/cxx/seq.hh
new file mode 100644
index 0000000..f206c61
--- /dev/null
+++ b/dux/include/dux/cxx/seq.hh
@@ -0,0 +1,47 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ template<typename T> inline auto bytefill(T * const _in,::dux::uwrd const _num,::dux::uint8 const _val) noexcept -> void {
+ static_assert(!::dux::issame<T,void>);
+ dux_priv_ifconsteval {
+ if (_num == dux_uwrdl(0x0)) [[unlikely]] {return;}
+ auto const in {reinterpret_cast<::dux::uint8 *>(_in)};
+ auto const numbyte {_num * sizeof (T)};
+ for (auto pos = dux_uwrdl(0x0);pos < numbyte;++pos) {in[pos] = _val;}
+ }
+ else {::dux_priv_fill(_in,_num,_val,sizeof (T));}
+ }
+
+ template<typename T> dux_attr_hot constexpr auto cpy(T const * const restrict _in,::dux::uwrd const _num,T * const restrict _out) noexcept -> void {
+ static_assert(!::dux::issame<T,void>);
+ dux_priv_ifconsteval {
+ if (_num == dux_uwrdl(0x0)) [[unlikely]] {return;}
+ for (::dux::uwrd pos = dux_uwrdl(0x0);pos != _num;++pos) {_out[pos] = _in[pos];}
+ }
+ else {::dux_priv_cpy(_in,_num,_out,sizeof (T));}
+ }
+
+ template<typename T,::dux::cnvto<T> T0> constexpr auto fill(T * const restrict _in,::dux::uwrd const _num,T0 const & _val) noexcept -> void {
+ static_assert(!::dux::issame<T,void>);
+ if (_num == dux_uwrdl(0x0)) [[unlikely]] {return;}
+ auto const & val {static_cast<T const &>(_val)};
+ for (auto pos = dux_uwrdl(0x0);pos < _num;++pos) {_in[pos] = val;}
+ }
+}
diff --git a/dux/include/dux/cxx/sig.hh b/dux/include/dux/cxx/sig.hh
new file mode 100644
index 0000000..b295730
--- /dev/null
+++ b/dux/include/dux/cxx/sig.hh
@@ -0,0 +1,96 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ enum class sig : ::dux::uint8 {
+ abrt = static_cast<::dux::uint8>(dux_priv_sig_abrt),
+ alrm = static_cast<::dux::uint8>(dux_priv_sig_alrm),
+ bus = static_cast<::dux::uint8>(dux_priv_sig_bus),
+ chld = static_cast<::dux::uint8>(dux_priv_sig_chld),
+ cont = static_cast<::dux::uint8>(dux_priv_sig_cont),
+ fpe = static_cast<::dux::uint8>(dux_priv_sig_fpe),
+ hup = static_cast<::dux::uint8>(dux_priv_sig_hup),
+ ill = static_cast<::dux::uint8>(dux_priv_sig_ill),
+ io = static_cast<::dux::uint8>(dux_priv_sig_io),
+ iot = static_cast<::dux::uint8>(dux_priv_sig_iot),
+ intr = static_cast<::dux::uint8>(dux_priv_sig_intr),
+ kill = static_cast<::dux::uint8>(dux_priv_sig_kill),
+ pipe = static_cast<::dux::uint8>(dux_priv_sig_pipe),
+ poll = static_cast<::dux::uint8>(dux_priv_sig_poll),
+ prof = static_cast<::dux::uint8>(dux_priv_sig_prof),
+ pwr = static_cast<::dux::uint8>(dux_priv_sig_pwr),
+ quit = static_cast<::dux::uint8>(dux_priv_sig_quit),
+ segv = static_cast<::dux::uint8>(dux_priv_sig_segv),
+ stop = static_cast<::dux::uint8>(dux_priv_sig_stop),
+ sys = static_cast<::dux::uint8>(dux_priv_sig_sys),
+ term = static_cast<::dux::uint8>(dux_priv_sig_term),
+ trap = static_cast<::dux::uint8>(dux_priv_sig_trap),
+ tstp = static_cast<::dux::uint8>(dux_priv_sig_tstp),
+ ttin = static_cast<::dux::uint8>(dux_priv_sig_ttin),
+ ttou = static_cast<::dux::uint8>(dux_priv_sig_ttou),
+ urg = static_cast<::dux::uint8>(dux_priv_sig_urg),
+ usr1 = static_cast<::dux::uint8>(dux_priv_sig_usr1),
+ usr2 = static_cast<::dux::uint8>(dux_priv_sig_usr2),
+ vtalrm = static_cast<::dux::uint8>(dux_priv_sig_vtalrm),
+ winch = static_cast<::dux::uint8>(dux_priv_sig_winch),
+ xcpu = static_cast<::dux::uint8>(dux_priv_sig_xcpu),
+ xfsz = static_cast<::dux::uint8>(dux_priv_sig_xfsz),
+ };
+
+ constexpr auto numsig {dux_priv_numsig};
+}
+
+namespace dux {
+ class sighandl;
+}
+
+namespace dux {
+ auto raise( ::dux::sig sig) noexcept -> void;
+ auto setsighandl(::dux::sig sig,::dux::sighandl sighandl) noexcept -> void;
+}
+
+namespace dux {
+ class sighandl {
+ public:
+ [[nodiscard]] sighandl() noexcept = default;
+
+ template<typename Fn> [[nodiscard]] constexpr sighandl(Fn const & _handl) noexcept {
+ this->_isdfl = false;
+ this->handl = _handl;
+ }
+
+ [[nodiscard]] consteval static auto dfl() noexcept -> ::dux::sighandl {
+ ::dux::sighandl sighandl;
+ sighandl.handl = nullptr;
+ sighandl._isdfl = true;
+ return sighandl;
+ }
+
+ [[nodiscard]] constexpr auto operator == (::dux::sighandl const & _oth) const noexcept -> bool {
+ if (this->_isdfl && _oth._isdfl) {return true;}
+ return this->handl == _oth.handl;
+ }
+
+ auto (* handl)(::dux::sig sig) -> bool;
+
+ friend auto ::dux::setsighandl(::dux::sig sig,::dux::sighandl sighandl) noexcept -> void;
+ private:
+ bool _isdfl = true;
+ };
+}
diff --git a/dux/include/dux/cxx/str.hh b/dux/include/dux/cxx/str.hh
new file mode 100644
index 0000000..155f661
--- /dev/null
+++ b/dux/include/dux/cxx/str.hh
@@ -0,0 +1,92 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+namespace dux {
+ [[nodiscard]] constexpr auto fndchr(char const * const restrict _str,char const _chr) noexcept -> ::dux::uwrd {
+ for (::dux::uwrd n = dux_uwrdl(0x0);_str[n] != '\u0000';++n) {if (_str[n] == _chr) {return n;}}
+ return dux_uwrdl(-0x1);
+ }
+
+ [[nodiscard]] constexpr auto strcmp(char const * const restrict _lstr,char const * const restrict _rstr) noexcept -> ::dux::sint8 {
+ auto lptr {_lstr};
+ auto rptr {_rstr};
+ for (;;++lptr,++rptr) {
+ auto const lchr = *lptr;
+ auto const rchr = *rptr;
+ if (lchr != rchr) [[unlikely]] {
+ if (lchr > rchr) {return dux_sint8l(-0x1);}
+ if (lchr < rchr) {return dux_sint8l(0x1);}
+ }
+ }
+ return dux_sint8l(0x0);
+ }
+
+ [[nodiscard]] constexpr auto streq(char const * const restrict _lstr,char const * const restrict _rstr) noexcept -> bool {
+ auto lptr {_lstr};
+ auto rptr {_rstr};
+ for (;;++lptr,++rptr) {
+ if (*lptr != *rptr) {return false;}
+ if (*lptr == '\u0000' || *rptr == '\u0000') {return true;}
+ }
+ ::dux::unreach();
+ }
+
+ [[nodiscard]] constexpr auto strlen(char const * const restrict _str) noexcept -> ::dux::uwrd {
+ auto sz = dux_uwrdl(0x0);
+ for (::dux::uwrd n = dux_uwrdl(0x0);;++n) {
+ if (_str[n] == '\u0000') [[unlikely]] {
+ break;
+ }
+ ++sz;
+ }
+ return sz;
+ }
+
+ constexpr auto strcpy(char const * const restrict _src,char * const restrict _dest) noexcept -> void {
+ auto const sz = ::dux::strlen(_src);
+ if (sz == dux_uwrdl(0x0)) [[unlikely]] {return;}
+ ::dux::cpy(_src,sz,_dest);
+ }
+
+ [[nodiscard]] constexpr auto strdup(char const * const restrict _str) noexcept -> ::dux::str {
+ ::dux::str str;
+ str.sz = ::dux::strlen(_str);
+ auto const rawstr {::dux::alloc<char>(str.sz)};
+ ::dux::cpy(_str,str.sz,rawstr);
+ str.ptr = rawstr;
+ return str;
+ }
+}
+
+namespace dux {
+# include <dux/str.d/uniblk.ii>
+# include <dux/str.d/uninm.ii>
+
+# include <dux/str.d/isdigit.ii>
+# include <dux/str.d/islower.ii>
+# include <dux/str.d/ispunct.ii>
+# include <dux/str.d/isspace.ii>
+# include <dux/str.d/issurro.ii>
+# include <dux/str.d/isupper.ii>
+# include <dux/str.d/isxdigit.ii>
+
+# include <dux/str.d/isalpha.ii>
+
+# include <dux/str.d/isalnum.ii>
+}
diff --git a/dux/include/dux/cxx/thrd.hh b/dux/include/dux/cxx/thrd.hh
new file mode 100644
index 0000000..86f5c17
--- /dev/null
+++ b/dux/include/dux/cxx/thrd.hh
@@ -0,0 +1,18 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
diff --git a/src/dux/_getpthrdhandl.cc b/dux/include/dux/cxx/time.hh
index 4968d44..d24e1f8 100644
--- a/src/dux/_getpthrdhandl.cc
+++ b/dux/include/dux/cxx/time.hh
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,7 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <dux/thrd>
-
-#include "priv.hh"
-
-auto ::dux::_getpthrdhandl() -> void * {
- return ::new ::dux::_pthrddat;
+namespace dux {
+ [[nodiscard]] auto gettime() noexcept -> ::dux::sint64;
+ auto sleep( ::dux::uint64 sec) noexcept -> void;
}
diff --git a/include/dux/str b/dux/include/dux/io
index 57856e7..c0a05d5 100644
--- a/include/dux/str
+++ b/dux/include/dux/io
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,12 +17,14 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_str)
-#define dux_hdr_str
+# pragma once
-#include <dux/arr>
-#include <dux/cstr>
+# include <dux/arr>
-#include <dux/str.hh>
+# include <dux/io.h>
-#endif
+# if defined(dux_lang_c)
+# include <dux/c/io.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/io.hh>
+# endif
diff --git a/dux/include/dux/io.h b/dux/include/dux/io.h
new file mode 100644
index 0000000..9908110
--- /dev/null
+++ b/dux/include/dux/io.h
@@ -0,0 +1,24 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+enum dux_priv_iotyp {
+ dux_priv_iotyp_r,
+ dux_priv_iotyp_rw,
+ dux_priv_iotyp_w,
+};
diff --git a/dux/include/dux/math b/dux/include/dux/math
new file mode 100644
index 0000000..882573d
--- /dev/null
+++ b/dux/include/dux/math
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/base>
+
+# include <dux/math.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/math.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/math.hh>
+# endif
diff --git a/dux/include/dux/math.h b/dux/include/dux/math.h
new file mode 100644
index 0000000..f0456a6
--- /dev/null
+++ b/dux/include/dux/math.h
@@ -0,0 +1,84 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/* These numbers must be rounded to 64 digits. */
+# define dux_priv_num_cbrt2 (1.2599210498948731647672106072782283505702514647015079800819751122l)
+# define dux_priv_num_e (2.7182818284590452353602874713526624977572470936999595749669676277l)
+# define dux_priv_num_lg2 (0.3010299956639811952137388947244930267681898814621085413104274611l)
+# define dux_priv_num_ln2 (0.6931471805599453094172321214581765680755001343602552541206800095l)
+# define dux_priv_num_phi (1.6180339887498948482045868343656381177203091798057628621354486227l)
+# define dux_priv_num_pi (3.1415926535897932384626433832795028841971693993751058209749445923l)
+# define dux_priv_num_sqrt2 (1.4142135623730950488016887242096980785696718753769480731766797380l)
+# define dux_priv_num_sqrt3 (1.7320508075688772935274463415058723669428052538103806280558069795l)
+
+# if dux_hasbuiltin(__builtin_huge_val) && dux_hasbuiltin(__builtin_huge_valf) && dux_hasbuiltin(__builtin_huge_vall)
+# define dux_priv_infd __builtin_huge_val()
+# define dux_priv_inff __builtin_huge_valf()
+# define dux_priv_infld __builtin_huge_vall()
+# else
+# define dux_priv_infd dux_dblmax
+# define dux_priv_inff dux_fltmax
+# define dux_priv_infld dux_ldblmax
+# endif
+
+# if dux_hasbuiltin(__builtin_nan) && dux_hasbuiltin(__builtin_nanf) && dux_hasbuiltin(__builtin_nanl)
+# define dux_priv_nand __builtin_nan("")
+# define dux_priv_nanf __builtin_nanf("")
+# define dux_priv_nanld __builtin_nanl("")
+# else
+# define dux_priv_nand dux_dblmax
+# define dux_priv_nanf dux_fltmax
+# define dux_priv_nanld dux_ldblmax
+# endif
+
+/* Functions we can implement using simple expressions (these may be used in constant evaluation): */
+# define dux_priv_abs( _val) ((_val) < (dux_priv_uint8)0x0 ? -(_val) : (_val))
+# define dux_priv_fma( _x, _y, _z) ((_x) * (_y) + (_z))
+# define dux_priv_isnan(_val) ((_val) != (_val))
+# define dux_priv_max( _val0,_val1) ((_val0) > (_val1) ? (_val0) : (_val1))
+# define dux_priv_min( _val0,_val1) ((_val0) > (_val1) ? (_val1) : (_val0))
+
+dux_priv_begincdecls
+
+dux_attr_const dux_attr_useret double dux_priv_ceild( double val); /* The ceiling of val */
+dux_attr_const dux_attr_useret float dux_priv_ceilf( float val);
+dux_attr_const dux_attr_useret long double dux_priv_ceilld( long double val);
+dux_attr_const dux_attr_useret double dux_priv_expd( double base,double exp); /* base raised to the power exp */
+dux_attr_const dux_attr_useret float dux_priv_expf( float base,float exp);
+dux_attr_const dux_attr_useret long double dux_priv_expld( long double base,long double exp);
+dux_attr_const dux_attr_useret double dux_priv_floord( double val); /* The floor of val */
+dux_attr_const dux_attr_useret float dux_priv_floorf( float val);
+dux_attr_const dux_attr_useret long double dux_priv_floorld(long double val);
+dux_attr_const dux_attr_useret double dux_priv_logd( double base,double val); /* Logarithm of base e of val */
+dux_attr_const dux_attr_useret float dux_priv_logf( float base,float val);
+dux_attr_const dux_attr_useret long double dux_priv_logld( long double base,long double val);
+dux_attr_const dux_attr_useret double dux_priv_rootd( double exp, double val); /* Root number exp of val */
+dux_attr_const dux_attr_useret float dux_priv_rootf( float exp, float val);
+dux_attr_const dux_attr_useret long double dux_priv_rootld( long double exp, long double val);
+dux_attr_const dux_attr_useret double dux_priv_roundd( double val); /* val rounded to the nearest whole number */
+dux_attr_const dux_attr_useret float dux_priv_roundf( float val);
+dux_attr_const dux_attr_useret long double dux_priv_roundld(long double val);
+dux_attr_const dux_attr_useret double dux_priv_sqrtd( double val); /* Square root */
+dux_attr_const dux_attr_useret float dux_priv_sqrtf( float val);
+dux_attr_const dux_attr_useret long double dux_priv_sqrtld( long double val);
+dux_attr_const dux_attr_useret double dux_priv_truncd( double val); /* val rounded to the nearest whole number torwards zero */
+dux_attr_const dux_attr_useret float dux_priv_truncf( float val);
+dux_attr_const dux_attr_useret long double dux_priv_truncld(long double val);
+
+dux_priv_endcdecls
diff --git a/dux/include/dux/media b/dux/include/dux/media
new file mode 100644
index 0000000..2f5b8e3
--- /dev/null
+++ b/dux/include/dux/media
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/base>
+
+# include <dux/media.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/media.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/media.hh>
+# endif
diff --git a/include/dux/io b/dux/include/dux/media.h
index 3c4413e..e3b7cd7 100644
--- a/include/dux/io
+++ b/dux/include/dux/media.h
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_io)
-#define dux_hdr_io
+dux_priv_begincdecls
-#include <dux/sys>
-#include <dux/io.hh>
+extern bool const dux_priv_nomedia;
-#endif
+dux_priv_endcdecls
diff --git a/dux/include/dux/mem b/dux/include/dux/mem
new file mode 100644
index 0000000..cd01e1c
--- /dev/null
+++ b/dux/include/dux/mem
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/seq>
+
+# include <dux/mem.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/mem.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/mem.hh>
+# endif
diff --git a/dux/include/dux/mem.h b/dux/include/dux/mem.h
new file mode 100644
index 0000000..10e4243
--- /dev/null
+++ b/dux/include/dux/mem.h
@@ -0,0 +1,27 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/* TO-DO: Implement our own memory allocation routines (independent of C stdlib). */
+
+dux_priv_begincdecls
+
+dux_attr_useret void * dux_priv_alloc(dux_priv_uwrd sz, dux_priv_uwrd align);
+ void dux_priv_free( void * ptr);
+
+dux_priv_endcdecls
diff --git a/dux/include/dux/seq b/dux/include/dux/seq
new file mode 100644
index 0000000..6b75e74
--- /dev/null
+++ b/dux/include/dux/seq
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/math>
+
+# include <dux/seq.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/seq.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/seq.hh>
+# endif
diff --git a/dux/include/dux/seq.h b/dux/include/dux/seq.h
new file mode 100644
index 0000000..a7d3c2e
--- /dev/null
+++ b/dux/include/dux/seq.h
@@ -0,0 +1,28 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+dux_priv_begincdecls
+
+void dux_priv_cpy( void const * in, dux_priv_uwrd num,void * out,dux_priv_uwrd sz);
+void * dux_priv_dup( void const * in, dux_priv_uwrd num,dux_priv_uwrd sz);
+void dux_priv_fill(void * ptr,dux_priv_uwrd num,dux_priv_uint8 val,dux_priv_uwrd sz);
+void dux_priv_plot(void const * ptr,dux_priv_uwrd num,dux_priv_uwrd sz,void (* fn)(void const * ptr));
+
+dux_priv_endcdecls
+
diff --git a/dux/include/dux/sig b/dux/include/dux/sig
new file mode 100644
index 0000000..947b57b
--- /dev/null
+++ b/dux/include/dux/sig
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/base>
+
+# include <dux/sig.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/sig.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/sig.hh>
+# endif
diff --git a/dux/include/dux/sig.h b/dux/include/dux/sig.h
new file mode 100644
index 0000000..b01e279
--- /dev/null
+++ b/dux/include/dux/sig.h
@@ -0,0 +1,218 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+/*
+ It is up to the user to make sure each signal is available on the target system before it is raised. Raising a signal that is not supported (such as SIGALRM on MS Windows) will invoke undefined behaviour, unless the mentioned signal is one of:
+ - SIGTERM: Invokes ::dux::exit(::dux::stat::err);
+ - SIGTRAP: Invokes ::dux::trap();
+*/
+enum dux_priv_sig { /* Refer to `man 7 signal` for values. */
+ dux_priv_sig_abrt = 0x6,
+ dux_priv_sig_alrm = 0xE,
+# if defined(dux_os_freebsd)
+ dux_priv_sig_bus = 0xA,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_mips) || defined(dux_arch_sparc)
+ dux_priv_sig_bus = 0xA,
+# else
+ dux_priv_sig_bus = 0x7,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_chld = 0x14,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_chld = 0x14,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_chld = 0x12,
+# else
+ dux_priv_sig_chld = 0x11,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_cont = 0x13,
+# elif defined(dux_os_linux)
+ dux_priv_sig_cont = 0x12,
+# endif
+ dux_priv_sig_fpe = 0x8,
+ dux_priv_sig_hup = 0x1,
+ dux_priv_sig_ill = 0x4,
+# if defined(dux_os_freebsd)
+ dux_priv_sig_io = 0x17,
+# elif defined(dux_os_linux)
+ dux_priv_sig_io = 0x1D,
+# endif
+ dux_priv_sig_iot = 0x6,
+ dux_priv_sig_intr = 0x2,
+ dux_priv_sig_kill = 0x9,
+ dux_priv_sig_pipe = 0xD,
+# if defined(dux_os_linux)
+ dux_priv_sig_poll = 0x1D,
+# else
+ dux_priv_sig_poll = 0xFF,
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_prof = 0x1B,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_prof = 0x1D,
+# else
+ dux_priv_sig_prof = 0x1B,
+# endif
+# endif
+# if defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_pwr = 0x1D,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_pwr = 0x13,
+# else
+ dux_priv_sig_pwr = 0x1E,
+# endif
+# else
+ dux_priv_sig_pwr = 0xFF,
+# endif
+ dux_priv_sig_quit = 0x3,
+ dux_priv_sig_segv = 0xB,
+# if defined(dux_os_freebsd)
+ dux_priv_sig_stop = 0x11,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_stop = 0x11,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_stop = 0x17,
+# else
+ dux_priv_sig_stop = 0x13,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_sys = 0xC,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_mips) || defined(dux_arch_sparc)
+ dux_priv_sig_sys = 0xC,
+# else
+ dux_priv_sig_sys = 0x1F,
+# endif
+# endif
+ dux_priv_sig_term = 0xF,
+ dux_priv_sig_trap = 0x5,
+# if defined(dux_os_freebsd)
+ dux_priv_sig_tstp = 0x12,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_tstp = 0x12,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_tstp = 0x18,
+# else
+ dux_priv_sig_tstp = 0x14,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_ttin = 0x15,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_ttin = 0x1A,
+# else
+ dux_priv_sig_ttin = 0x15,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_ttou = 0x16,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_ttou = 0x1B,
+# else
+ dux_priv_sig_ttou = 0x16,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_urg = 0x10,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_urg = 0x1C,
+# else
+ dux_priv_sig_urg = 0x17,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_usr1 = 0x1E,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_usr1 = 0x1E,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_usr1 = 0x10,
+# else
+ dux_priv_sig_usr1 = 0xA,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_usr2 = 0x1F,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_alpha) || defined(dux_arch_sparc)
+ dux_priv_sig_usr2 = 0x1F,
+# elif defined(dux_arch_mips)
+ dux_priv_sig_usr2 = 0x11,
+# else
+ dux_priv_sig_usr2 = 0xC,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_vtalrm = 0x1A,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_vtalrm = 0x1C,
+# else
+ dux_priv_sig_vtalrm = 0x1A,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_winch = 0x1C,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_winch = 0x14,
+# else
+ dux_priv_sig_winch = 0x1C,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_xcpu = 0x18,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_xcpu = 0x1E,
+# else
+ dux_priv_sig_xcpu = 0x18,
+# endif
+# endif
+# if defined(dux_os_freebsd)
+ dux_priv_sig_xfsz = 0x19,
+# elif defined(dux_os_linux)
+# if defined(dux_arch_mips)
+ dux_priv_sig_xfsz = 0x1F,
+# else
+ dux_priv_sig_xfsz = 0x19,
+# endif
+# endif
+};
+# define dux_priv_numsig dux_uint8l(0x20)
+
+# if defined(dux_lang_c)
+# define dux_priv_ctyp_sighandl dux_sighandl
+# elif defined(dux_lang_cxx)
+typedef auto (* dux_priv_ctyp_sighandl)(::dux_priv_sig sig) -> bool;
+# endif
+# define dux_priv_dflcsighandl (dux_priv_ctyp_sighandl)((dux_priv_uint8 *)dux_uwrdl(-0x1))
diff --git a/dux/include/dux/str b/dux/include/dux/str
new file mode 100644
index 0000000..218fa87
--- /dev/null
+++ b/dux/include/dux/str
@@ -0,0 +1,31 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/mem>
+# include <dux/seq>
+
+# include <dux/str.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/str.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/str.hh>
+# endif
diff --git a/include/dux/str.d/isalpha.hh b/dux/include/dux/str.d/isalnum.ii
index 49b5de6..cc08476 100644
--- a/include/dux/str.d/isalpha.hh
+++ b/dux/include/dux/str.d/isalnum.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,6 +17,6 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isalnum(char32_t const _chr) -> bool {
+[[nodiscard]] dux_attr_const constexpr auto isalnum(char32_t const _chr) noexcept -> bool {
return ::dux::isalpha(_chr) || ::dux::isdigit(_chr);
}
diff --git a/include/dux/str.d/isalnum.hh b/dux/include/dux/str.d/isalpha.ii
index e7cc7aa..220774f 100644
--- a/include/dux/str.d/isalnum.hh
+++ b/dux/include/dux/str.d/isalpha.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,14 +17,11 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isalpha(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
+[[nodiscard]] dux_attr_const constexpr auto isalpha(char32_t const _chr) noexcept -> bool {
if(::dux::islower(_chr) || ::dux::isupper(_chr)) [[unlikely]] {
return true;
}
- switch(_chr) {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0297': /* LATIN LETTER GLOTTAL STOP */
diff --git a/include/dux/str.d/iscntrl.hh b/dux/include/dux/str.d/iscntrl.ii
index f3e9cfb..2fa4ae8 100644
--- a/include/dux/str.d/iscntrl.hh
+++ b/dux/include/dux/str.d/iscntrl.ii
@@ -1,6 +1,5 @@
-// --C++--
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -18,14 +17,11 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::iscntrl(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto iscntrl(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
- case U'\u0000': /* NULL */
+ case U'\u0000': /* nullptr */
[[fallthrough]];
case U'\u0001': /* START OF HEADING */
[[fallthrough]];
@@ -45,7 +41,7 @@ constexpr auto ::dux::iscntrl(char32_t const _chr) -> bool {
[[fallthrough]];
case U'\t': /* HORIZONTAL TABULATION */
[[fallthrough]];
- case U'\n': /* NEW LINE */
+ case U'\n': /* ::new LINE */
[[fallthrough]];
case U'\v': /* VERTICAL TABULATION */
[[fallthrough]];
@@ -89,7 +85,7 @@ constexpr auto ::dux::iscntrl(char32_t const _chr) -> bool {
[[fallthrough]];
case U'\x1F': /* UNIT SEPERATOR */
[[fallthrough]];
- case U'\x7F': /* DELETE */
+ case U'\x7F': /* ::delete */
[[fallthrough]];
case U'\x80': /* <CONTROL> */
[[fallthrough]];
diff --git a/include/dux/str.d/isdigit.hh b/dux/include/dux/str.d/isdigit.ii
index 52f5bd4..12875e8 100644
--- a/include/dux/str.d/isdigit.hh
+++ b/dux/include/dux/str.d/isdigit.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isdigit(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto isdigit(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0030': /* DIGIT ZERO */
diff --git a/include/dux/str.d/islower.hh b/dux/include/dux/str.d/islower.ii
index 0800573..e02e800 100644
--- a/include/dux/str.d/islower.hh
+++ b/dux/include/dux/str.d/islower.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::islower(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto islower(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0061': /* LATIN SMALL LETTER A */
diff --git a/include/dux/str.d/ispunct.hh b/dux/include/dux/str.d/ispunct.ii
index bfa0ceb..90d62ec 100644
--- a/include/dux/str.d/ispunct.hh
+++ b/dux/include/dux/str.d/ispunct.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::ispunct(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto ispunct(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0021': /* EXCLAMATION MARK */
diff --git a/include/dux/str.d/isspace.hh b/dux/include/dux/str.d/isspace.ii
index 79f3487..80ba39f 100644
--- a/include/dux/str.d/isspace.hh
+++ b/dux/include/dux/str.d/isspace.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,16 +17,13 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isspace(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto isspace(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0009': /* HORIZONTAL TABULATION */
[[fallthrough]];
- case U'\u000A': /* NEW LINE */
+ case U'\u000A': /* ::new LINE */
[[fallthrough]];
case U'\u000B': /* VERTICAL TABULATION */
[[fallthrough]];
diff --git a/include/dux/str.d/issurro.hh b/dux/include/dux/str.d/issurro.ii
index 115bc0f..ebf3b50 100644
--- a/include/dux/str.d/issurro.hh
+++ b/dux/include/dux/str.d/issurro.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,7 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::issurro(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
+[[nodiscard]] dux_attr_const constexpr auto issurro(char32_t const _chr) noexcept -> bool {
if(_chr >= U'\xD800' && _chr <= U'\xDFFF') [[unlikely]] {
return true;
}
diff --git a/include/dux/str.d/isupper.hh b/dux/include/dux/str.d/isupper.ii
index 7e96224..470ab7c 100644
--- a/include/dux/str.d/isupper.hh
+++ b/dux/include/dux/str.d/isupper.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isupper(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto isupper(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
case U'\u0041': /* LATIN CAPITAL LETTER A */
diff --git a/include/dux/str.d/isxdigit.hh b/dux/include/dux/str.d/isxdigit.ii
index 980ed5c..29a613b 100644
--- a/include/dux/str.d/isxdigit.hh
+++ b/dux/include/dux/str.d/isxdigit.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,8 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::isxdigit(char32_t const _chr) -> bool {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::outofdomain("Unicode codepoint too big!");
- }
- switch(_chr) {
+[[nodiscard]] dux_attr_const constexpr auto isxdigit(char32_t const _chr) noexcept -> bool {
+ switch (_chr) {
[[likely]] default:
return false;
break;
diff --git a/include/dux/str.d/uniblk.hh b/dux/include/dux/str.d/uniblk.ii
index 4a5d1be..8df097b 100644
--- a/include/dux/str.d/uniblk.hh
+++ b/dux/include/dux/str.d/uniblk.ii
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,474 +17,471 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-constexpr auto ::dux::uniblk(char32_t const _chr) -> ::dux::str {
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::invalutf("Unicode codepoint too big!");
- }
+[[nodiscard]] dux_attr_const constexpr auto uniblk(char32_t const _chr) noexcept -> char const * {
if(_chr <= U'\u007F') {
- return U"BASIC LATIN";
+ return "BASIC LATIN";
}
if(_chr >= U'\u0080' && _chr <= U'\u00FF') {
- return U"LATIN-1 SUPPLEMENT";
+ return "LATIN-1 SUPPLEMENT";
}
if(_chr >= U'\u0100' && _chr <= U'\u017F') {
- return U"LATIN EXTENDED-A";
+ return "LATIN EXTENDED-A";
}
if(_chr >= U'\u0180' && _chr <= U'\u024F') {
- return U"LATIN EXTENDED-B";
+ return "LATIN EXTENDED-B";
}
if(_chr >= U'\u0250' && _chr <= U'\u02AF') {
- return U"IPA EXTENSIONS";
+ return "IPA EXTENSIONS";
}
if(_chr >= U'\u02B0' && _chr <= U'\u02FF') {
- return U"SPACING MODIFIER LETTERS";
+ return "SPACING MODIFIER LETTERS";
}
if(_chr >= U'\u0300' && _chr <= U'\u036F') {
- return U"COMBINING DIRACITICAL MARKS";
+ return "COMBINING DIRACITICAL MARKS";
}
if(_chr >= U'\u0370' && _chr <= U'\u03FF') {
- return U"GREEK AND COPTIC";
+ return "GREEK AND COPTIC";
}
if(_chr >= U'\u0400' && _chr <= U'\u04FF') {
- return U"CYRILLIC";
+ return "CYRILLIC";
}
if(_chr >= U'\u0500' && _chr <= U'\u052F') {
- return U"CYRILLIC SUPPLEMENT";
+ return "CYRILLIC SUPPLEMENT";
}
if(_chr >= U'\u0530' && _chr <= U'\u058F') {
- return U"ARMENIAN";
+ return "ARMENIAN";
}
if(_chr >= U'\u0590' && _chr <= U'\u05FF') {
- return U"HEBREW";
+ return "HEBREW";
}
if(_chr >= U'\u0600' && _chr <= U'\u06FF') {
- return U"ARABIC";
+ return "ARABIC";
}
if(_chr >= U'\u0700' && _chr <= U'\u074F') {
- return U"SYRIAC";
+ return "SYRIAC";
}
if(_chr >= U'\u0750' && _chr <= U'\u077F') {
- return U"ARABIC SUPPLEMENT";
+ return "ARABIC SUPPLEMENT";
}
if(_chr >= U'\u0780' && _chr <= U'\u07BF') {
- return U"THAANA";
+ return "THAANA";
}
if(_chr >= U'\u07C0' && _chr <= U'\u07FF') {
- return U"NKO";
+ return "NKO";
}
if(_chr >= U'\u0800' && _chr <= U'\u083F') {
- return U"SAMARITAN";
+ return "SAMARITAN";
}
if(_chr >= U'\u0840' && _chr <= U'\u085F') {
- return U"MANDAIC";
+ return "MANDAIC";
}
if(_chr >= U'\u0860' && _chr <= U'\u086F') {
- return U"SYRIAC SUPPLEMENT";
+ return "SYRIAC SUPPLEMENT";
}
if(_chr >= U'\u08A0' && _chr <= U'\u08FF') {
- return U"ARABIC EXTENDED-A";
+ return "ARABIC EXTENDED-A";
}
if(_chr >= U'\u0900' && _chr <= U'\u097F') {
- return U"DEVANAGARI";
+ return "DEVANAGARI";
}
if(_chr >= U'\u0980' && _chr <= U'\u09FF') {
- return U"BENGALI";
+ return "BENGALI";
}
if(_chr >= U'\u0A00' && _chr <= U'\u0A7F') {
- return U"GURMUKHI";
+ return "GURMUKHI";
}
if(_chr >= U'\u0A80' && _chr <= U'\u0AFF') {
- return U"GUJARATI";
+ return "GUJARATI";
}
if(_chr >= U'\u0B00' && _chr <= U'\u0B7F') {
- return U"ORIYAS";
+ return "ORIYAS";
}
if(_chr >= U'\u0B80' && _chr <= U'\u0BFF') {
- return U"TAMIL";
+ return "TAMIL";
}
if(_chr >= U'\u0C00' && _chr <= U'\u0C7F') {
- return U"TELUGU";
+ return "TELUG";
}
if(_chr >= U'\u0C80' && _chr <= U'\u0CFF') {
- return U"KANNADA";
+ return "KANNADA";
}
if(_chr >= U'\u0D00' && _chr <= U'\u0D7F') {
- return U"MALAYALAM";
+ return "MALAYALAM";
}
if(_chr >= U'\u0D80' && _chr <= U'\u0DFF') {
- return U"SINHALA";
+ return "SINHALA";
}
if(_chr >= U'\u0E00' && _chr <= U'\u0E7F') {
- return U"THAI";
+ return "THAI";
}
if(_chr >= U'\u0E80' && _chr <= U'\u0EFF') {
- return U"LAO";
+ return "LAO";
}
if(_chr >= U'\u0F00' && _chr <= U'\u0FFF') {
- return U"TIBETAN";
+ return "TIBETAN";
}
if(_chr >= U'\u1000' && _chr <= U'\u109F') {
- return U"MYANMAR";
+ return "MYANMAR";
}
if(_chr >= U'\u10A0' && _chr <= U'\u10FF') {
- return U"GEORGIAN";
+ return "GEORGIAN";
}
if(_chr >= U'\u1100' && _chr <= U'\u11FF') {
- return U"HANGUL JAMO";
+ return "HANGUL JAMO";
}
if(_chr >= U'\u1200' && _chr <= U'\u137F') {
- return U"ETHIOPIC";
+ return "ETHIOPIC";
}
if(_chr >= U'\u1380' && _chr <= U'\u139F') {
- return U"ETHIOPIC SUPPLEMENT";
+ return "ETHIOPIC SUPPLEMENT";
}
if(_chr >= U'\u13A0' && _chr <= U'\u13FF') {
- return U"CHEROKEE";
+ return "CHEROKEE";
}
if(_chr >= U'\u1400' && _chr <= U'\u167F') {
- return U"UNIFIED CANADIAN ABORIGINAL SYLLABICS";
+ return "UNIFIED CANADIAN ABORIGINAL SYLLABICS";
}
if(_chr >= U'\u1680' && _chr <= U'\u169F') {
- return U"OGHAM";
+ return "OGHAM";
}
if(_chr >= U'\u16A0' && _chr <= U'\u16FF') {
- return U"RUNIC";
+ return "RUNIC";
}
if(_chr >= U'\u1700' && _chr <= U'\u171F') {
- return U"TAGALOG";
+ return "TAGALOG";
}
if(_chr >= U'\u1720' && _chr <= U'\u173F') {
- return U"HANUNOO";
+ return "HANUNOO";
}
if(_chr >= U'\u1740' && _chr <= U'\u175F') {
- return U"BUHID";
+ return "BUHID";
}
if(_chr >= U'\u1760' && _chr <= U'\u177F') {
- return U"TAGBANWA";
+ return "TAGBANWA";
}
if(_chr >= U'\u1700' && _chr <= U'\u17FF') {
- return U"TAGALOG";
+ return "TAGALOG";
}
if(_chr >= U'\u1780' && _chr <= U'\u171F') {
- return U"KHMER";
+ return "KHMER";
}
if(_chr >= U'\u1800' && _chr <= U'\u18AF') {
- return U"MONGOLIAN";
+ return "MONGOLIAN";
}
if(_chr >= U'\u18B0' && _chr <= U'\u18FF') {
- return U"UNIFIED CANADIAN ABORIGINAL SYLLABICS EXTENDED";
+ return "UNIFIED CANADIAN ABORIGINAL SYLLABICS EXTENDED";
}
if(_chr >= U'\u1900' && _chr <= U'\u194F') {
- return U"LIMBU";
+ return "LIMB";
}
if(_chr >= U'\u1950' && _chr <= U'\u197F') {
- return U"TAI LE";
+ return "TAI LE";
}
if(_chr >= U'\u1980' && _chr <= U'\u19DF') {
- return U"NEW TAI LUE";
+ return "::new TAI LUE";
}
if(_chr >= U'\u19E0' && _chr <= U'\u19FF') {
- return U"KHMER SYMBOLS";
+ return "KHMER SYMBOLS";
}
if(_chr >= U'\u1A00' && _chr <= U'\u1A1F') {
- return U"BUGINESE";
+ return "BUGINESE";
}
if(_chr >= U'\u1A20' && _chr <= U'\u1AAF') {
- return U"TAI THAM";
+ return "TAI THAM";
}
if(_chr >= U'\u1AB0' && _chr <= U'\u1AFF') {
- return U"COMBINING DIACRITICAL MARKS EXTENDED";
+ return "COMBINING DIACRITICAL MARKS EXTENDED";
}
if(_chr >= U'\u1B00' && _chr <= U'\u1B7F') {
- return U"BALINESE";
+ return "BALINESE";
}
if(_chr >= U'\u1B80' && _chr <= U'\u1BBF') {
- return U"SUNDANESE";
+ return "SUNDANESE";
}
if(_chr >= U'\u1BC0' && _chr <= U'\u1BFF') {
- return U"BATAK";
+ return "BATAK";
}
if(_chr >= U'\u1C00' && _chr <= U'\u1C4F') {
- return U"LEPCHA";
+ return "LEPCHA";
}
if(_chr >= U'\u1C50' && _chr <= U'\u1C7F') {
- return U"OL CHIKI";
+ return "OL CHIKI";
}
if(_chr >= U'\u1C80' && _chr <= U'\u1C8F') {
- return U"CYRILLIC EXTENDED C";
+ return "CYRILLIC EXTENDED C";
}
if(_chr >= U'\u1C90' && _chr <= U'\u1CBF') {
- return U"GEORGIAN EXTENDED";
+ return "GEORGIAN EXTENDED";
}
if(_chr >= U'\u1CC0' && _chr <= U'\u1CCF') {
- return U"SUNDANESE SUPPLEMENT";
+ return "SUNDANESE SUPPLEMENT";
}
if(_chr >= U'\u1CD0' && _chr <= U'\u1CFF') {
- return U"VEDIC EXTENSIONS";
+ return "VEDIC EXTENSIONS";
}
if(_chr >= U'\u1D00' && _chr <= U'\u1D7F') {
- return U"PHONETIC EXTENSIONS";
+ return "PHONETIC EXTENSIONS";
}
if(_chr >= U'\u1D80' && _chr <= U'\u1DBF') {
- return U"PHONETIC EXTENSIONS SUPPLEMENT";
+ return "PHONETIC EXTENSIONS SUPPLEMENT";
}
if(_chr >= U'\u1DC0' && _chr <= U'\u1DFF') {
- return U"COMBINING DIACRITICAL MARKS SUPPLEMENT";
+ return "COMBINING DIACRITICAL MARKS SUPPLEMENT";
}
if(_chr >= U'\u1E00' && _chr <= U'\u1EFF') {
- return U"LATIN EXTENDED ADDITIONAL";
+ return "LATIN EXTENDED ADDITIONAL";
}
if(_chr >= U'\u1F00' && _chr <= U'\u1FFF') {
- return U"GREEK EXTENDED";
+ return "GREEK EXTENDED";
}
if(_chr >= U'\u2000' && _chr <= U'\u206F') {
- return U"GENERAL PUNCTUATION";
+ return "GENERAL PUNCTUATION";
}
if(_chr >= U'\u2070' && _chr <= U'\u209F') {
- return U"SUPERSCRIPTS AND SUBSCRIPTS";
+ return "SUPERSCRIPTS AND SUBSCRIPTS";
}
if(_chr >= U'\u20A0' && _chr <= U'\u20CF') {
- return U"CURRENCY SYMBOLS";
+ return "CURRENCY SYMBOLS";
}
if(_chr >= U'\u20D0' && _chr <= U'\u20FF') {
- return U"COMBINING DIACRITICAL MARKS FOR SYMBOLS";
+ return "COMBINING DIACRITICAL MARKS FOR SYMBOLS";
}
if(_chr >= U'\u2100' && _chr <= U'\u214F') {
- return U"LETTERLIKE SYMBOLS";
+ return "LETTERLIKE SYMBOLS";
}
if(_chr >= U'\u2150' && _chr <= U'\u218F') {
- return U"NUMBER FORMS";
+ return "NUMBER FORMS";
}
if(_chr >= U'\u2190' && _chr <= U'\u21FF') {
- return U"ARROWS";
+ return "ARROWS";
}
if(_chr >= U'\U00011A00' && _chr <= U'\U00011A4F') {
- return U"ZANABAZAR SQUARE";
+ return "ZANABAZAR SQUARE";
}
if(_chr >= U'\U00011A50' && _chr <= U'\U00011AAF') {
- return U"SOYOMBO";
+ return "SOYOMBO";
}
if(_chr >= U'\U00011AC0' && _chr <= U'\U00011AFF') {
- return U"PAU CIN HAU";
+ return "PAU CIN HA";
}
if(_chr >= U'\U00011C00' && _chr <= U'\U00011C6F') {
- return U"BHAIKSUKI";
+ return "BHAIKSUKI";
}
if(_chr >= U'\U00011C70' && _chr <= U'\U00011CBF') {
- return U"MARCHEN";
+ return "MARCHEN";
}
if(_chr >= U'\U00011D00' && _chr <= U'\U00011D5F') {
- return U"MASARAM GONDI";
+ return "MASARAM GONDI";
}
if(_chr >= U'\U00011D60' && _chr <= U'\U00011DAF') {
- return U"GUNJALA GONDI";
+ return "GUNJALA GONDI";
}
if(_chr >= U'\U00011EE0' && _chr <= U'\U00011EFF') {
- return U"MAKASAR";
+ return "MAKASAR";
}
if(_chr >= U'\U00011FB0' && _chr <= U'\U00011FBF') {
- return U"LISU SUPPLEMENT";
+ return "LISU SUPPLEMENT";
}
if(_chr >= U'\U00011FC0' && _chr <= U'\U00011FFF') {
- return U"TAMIL SUPPLEMENT";
+ return "TAMIL SUPPLEMENT";
}
if(_chr >= U'\U00012000' && _chr <= U'\U000123FF') {
- return U"CUNEIFORM";
+ return "CUNEIFORM";
}
if(_chr >= U'\U00012400' && _chr <= U'\U0001247F') {
- return U"CUNEIFORM NUMBERS AND PUNCTUATION";
+ return "CUNEIFORM NUMBERS AND PUNCTUATION";
}
if(_chr >= U'\U00012480' && _chr <= U'\U0001254F') {
- return U"EARLY DYNASTIC CUNEIFORM";
+ return "EARLY DYNASTIC CUNEIFORM";
}
if(_chr >= U'\U00013000' && _chr <= U'\U0001342F') {
- return U"EGYPTIAN HIEROGLYPHS";
+ return "EGYPTIAN HIEROGLYPHS";
}
if(_chr >= U'\U00013430' && _chr <= U'\U0001343F') {
- return U"EGYPTIAN HIEROGLYPH FORMAT CONTROLS";
+ return "EGYPTIAN HIEROGLYPH FORMAT CONTROLS";
}
if(_chr >= U'\U00014400' && _chr <= U'\U0001467F') {
- return U"ANATOLIAN HIEROGLYPHS";
+ return "ANATOLIAN HIEROGLYPHS";
}
if(_chr >= U'\U00016800' && _chr <= U'\U00016A3F') {
- return U"BAMUM SUPPLEMENT";
+ return "BAMUM SUPPLEMENT";
}
if(_chr >= U'\U00016A40' && _chr <= U'\U00016A6F') {
- return U"MRO";
+ return "MRO";
}
if(_chr >= U'\U00016AD0' && _chr <= U'\U00016AFF') {
- return U"BASSA VAH";
+ return "BASSA VAH";
}
if(_chr >= U'\U00016B00' && _chr <= U'\U00016B8F') {
- return U"PAHAWH HMONG";
+ return "PAHAWH HMONG";
}
if(_chr >= U'\U00016E40' && _chr <= U'\U00016E9F') {
- return U"MEDEFAIDRIN";
+ return "MEDEFAIDRIN";
}
if(_chr >= U'\U00016F00' && _chr <= U'\U00016F9F') {
- return U"MIAO";
+ return "MIAO";
}
if(_chr >= U'\U00016FE0' && _chr <= U'\U00016FFF') {
- return U"IDEOGRAPHIC SYMBOLS AND PUNCTUATION";
+ return "IDEOGRAPHIC SYMBOLS AND PUNCTUATION";
}
if(_chr >= U'\U00017000' && _chr <= U'\U000187FF') {
- return U"TANGUT";
+ return "TANGUT";
}
if(_chr >= U'\U00018800' && _chr <= U'\U00018AFF') {
- return U"TANGUT COMPONENTS";
+ return "TANGUT COMPONENTS";
}
if(_chr >= U'\U00018B00' && _chr <= U'\U00018CFF') {
- return U"KHITAN SMALL SCRIPT";
+ return "KHITAN SMALL SCRIPT";
}
if(_chr >= U'\U00018D00' && _chr <= U'\U00018D8F') {
- return U"TANGUT SUPPLEMENT";
+ return "TANGUT SUPPLEMENT";
}
if(_chr >= U'\U0001B000' && _chr <= U'\U0001B0FF') {
- return U"KANA SUPPLEMENT";
+ return "KANA SUPPLEMENT";
}
if(_chr >= U'\U0001B100' && _chr <= U'\U0001B12F') {
- return U"KANA EXTENDED-A";
+ return "KANA EXTENDED-A";
}
if(_chr >= U'\U0001B130' && _chr <= U'\U0001B16F') {
- return U"SMALL KANA EXTENSION";
+ return "SMALL KANA EXTENSION";
}
if(_chr >= U'\U0001B170' && _chr <= U'\U0001B2FF') {
- return U"NUSHU";
+ return "NUSH";
}
if(_chr >= U'\U0001BC00' && _chr <= U'\U0001BC9F') {
- return U"DUPLOYAN";
+ return "DUPLOYAN";
}
if(_chr >= U'\U0001BCA0' && _chr <= U'\U0001BCAF') {
- return U"SHORTHAND FORMAT CONTROLS";
+ return "SHORTHAND FORMAT CONTROLS";
}
if(_chr >= U'\U0001D000' && _chr <= U'\U0001D0FF') {
- return U"BYZANTINE MUSICAL SYMBOLS";
+ return "BYZANTINE MUSICAL SYMBOLS";
}
if(_chr >= U'\U0001D100' && _chr <= U'\U0001D1FF') {
- return U"MUSICAL SYMBOLS";
+ return "MUSICAL SYMBOLS";
}
if(_chr >= U'\U0001D200' && _chr <= U'\U0001D24F') {
- return U"ANCIENT GREEK MUSICAL NOTATION";
+ return "ANCIENT GREEK MUSICAL NOTATION";
}
if(_chr >= U'\U0001D2E0' && _chr <= U'\U0001D2FF') {
- return U"MAYAN NUMERALS";
+ return "MAYAN NUMERALS";
}
if(_chr >= U'\U0001D300' && _chr <= U'\U0001D35F') {
- return U"TAI XUAN JING SYMBOLS";
+ return "TAI XUAN JING SYMBOLS";
}
if(_chr >= U'\U0001D360' && _chr <= U'\U0001D37F') {
- return U"COUNTING ROD NUMERALS";
+ return "COUNTING ROD NUMERALS";
}
if(_chr >= U'\U0001D400' && _chr <= U'\U0001D7FF') {
- return U"MATHEMATICAL ALPHANUMERIC SYMBOLS";
+ return "MATHEMATICAL ALPHANUMERIC SYMBOLS";
}
if(_chr >= U'\U0001D800' && _chr <= U'\U0001DAAF') {
- return U"SUTTON SIGNWRITING";
+ return "SUTTON SIGNWRITING";
}
if(_chr >= U'\U0001E000' && _chr <= U'\U0001E02F') {
- return U"GLAGOLITIC SUPPLEMENT";
+ return "GLAGOLITIC SUPPLEMENT";
}
if(_chr >= U'\U0001E100' && _chr <= U'\U0001E14F') {
- return U"NYIAKENG PUACHUE HMONG";
+ return "NYIAKENG PUACHUE HMONG";
}
if(_chr >= U'\U0001E2C0' && _chr <= U'\U0001E2FF') {
- return U"WANCHO";
+ return "WANCHO";
}
if(_chr >= U'\U0001E800' && _chr <= U'\U0001E8DF') {
- return U"MENDE KIKAKUI";
+ return "MENDE KIKAKUI";
}
if(_chr >= U'\U0001E900' && _chr <= U'\U0001E95F') {
- return U"ADLAM";
+ return "ADLAM";
}
if(_chr >= U'\U0001EC70' && _chr <= U'\U0001ECBF') {
- return U"INDIC SIYAQ NUMBERS";
+ return "INDIC SIYAQ NUMBERS";
}
if(_chr >= U'\U0001ED00' && _chr <= U'\U0001ED4F') {
- return U"OTTOMAN SIYAQ NUMBERS";
+ return "OTTOMAN SIYAQ NUMBERS";
}
if(_chr >= U'\U0001EE00' && _chr <= U'\U0001EEFF') {
- return U"ARABIC MATHEMATICAL ALPHABETIC SYMBOLS";
+ return "ARABIC MATHEMATICAL ALPHABETIC SYMBOLS";
}
if(_chr >= U'\U0001F000' && _chr <= U'\U0001F02F') {
- return U"MAHJONG TILES";
+ return "MAHJONG TILES";
}
if(_chr >= U'\U0001F030' && _chr <= U'\U0001F09F') {
- return U"DOMINO TILES";
+ return "DOMINO TILES";
}
if(_chr >= U'\U0001F0A0' && _chr <= U'\U0001F0FF') {
- return U"PLAYING CARDS";
+ return "PLAYING CARDS";
}
if(_chr >= U'\U0001F100' && _chr <= U'\U0001F1FF') {
- return U"ENCLOSED ALPHANUMERIC SUPPLEMENT";
+ return "ENCLOSED ALPHANUMERIC SUPPLEMENT";
}
if(_chr >= U'\U0001F200' && _chr <= U'\U0001F2FF') {
- return U"ENCLOSED IDEOGRAPHIC SUPPLEMENT";
+ return "ENCLOSED IDEOGRAPHIC SUPPLEMENT";
}
if(_chr >= U'\U0001F300' && _chr <= U'\U0001F5FF') {
- return U"MISCELLANEOUS SYMBOLS AND PICTOGRAPHS";
+ return "MISCELLANEOUS SYMBOLS AND PICTOGRAPHS";
}
if(_chr >= U'\U0001F600' && _chr <= U'\U0001F64F') {
- return U"EMOTICONS";
+ return "EMOTICONS";
}
if(_chr >= U'\U0001F650' && _chr <= U'\U0001F67F') {
- return U"ORNAMENTAL DINGBATS";
+ return "ORNAMENTAL DINGBATS";
}
if(_chr >= U'\U0001F680' && _chr <= U'\U0001F6FF') {
- return U"TRANSPORT AND MAP SYMBOLS";
+ return "TRANSPORT AND MAP SYMBOLS";
}
if(_chr >= U'\U0001F700' && _chr <= U'\U0001F77F') {
- return U"ALCHEMICAL SYMBOLS";
+ return "ALCHEMICAL SYMBOLS";
}
if(_chr >= U'\U0001F780' && _chr <= U'\U0001F7FF') {
- return U"GEOMETRIC SHAPES EXTENDED";
+ return "GEOMETRIC SHAPES EXTENDED";
}
if(_chr >= U'\U0001F800' && _chr <= U'\U0001F8FF') {
- return U"SUPPLEMENTAL ARROWS-C";
+ return "SUPPLEMENTAL ARROWS-C";
}
if(_chr >= U'\U0001F900' && _chr <= U'\U0001F9FF') {
- return U"SUPPLEMENTAL SYMBOLS AND PICTOGRAPHS";
+ return "SUPPLEMENTAL SYMBOLS AND PICTOGRAPHS";
}
if(_chr >= U'\U0001FA00' && _chr <= U'\U0001FA6F') {
- return U"CHESS SYMBOLS";
+ return "CHESS SYMBOLS";
}
if(_chr >= U'\U0001FA70' && _chr <= U'\U0001FAFF') {
- return U"SYMBOLS AND PICTOGRAPHS EXTENDED-A";
+ return "SYMBOLS AND PICTOGRAPHS EXTENDED-A";
}
if(_chr >= U'\U0001FB00' && _chr <= U'\U0001FBFF') {
- return U"SYMBOLS FOR LEGACY COMPUTING";
+ return "SYMBOLS FOR LEGACY COMPUTING";
}
if(_chr >= U'\U00020000' && _chr <= U'\U0002A6DF') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION B";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION B";
}
if(_chr >= U'\U0002A700' && _chr <= U'\U0002B73F') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION C";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION C";
}
if(_chr >= U'\U0002B740' && _chr <= U'\U0002B81F') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION D";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION D";
}
if(_chr >= U'\U0002B820' && _chr <= U'\U0002CEAF') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION E";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION E";
}
if(_chr >= U'\U0002CEB0' && _chr <= U'\U0002EBEF') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION F";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION F";
}
if(_chr >= U'\U0002F800' && _chr <= U'\U0002FA1F') {
- return U"CJK COMPATIBILITY IDEOGRAPHS SUPPLEMENT";
+ return "CJK COMPATIBILITY IDEOGRAPHS SUPPLEMENT";
}
if(_chr >= U'\U00030000' && _chr <= U'\U0003134F') {
- return U"CJK UNIFIED IDEOGRAPHS EXTENSION G";
+ return "CJK UNIFIED IDEOGRAPHS EXTENSION G";
}
if(_chr >= U'\U000E0000' && _chr <= U'\U000E007F') {
- return U"TAGS";
+ return "TAGS";
}
if(_chr >= U'\U000E0100' && _chr <= U'\U000E1EFF') {
- return U"VARIATION SELECTORS SUPPLEMENT";
+ return "VARIATION SELECTORS SUPPLEMENT";
}
if(_chr >= U'\U000F0000' && _chr <= U'\U000FFFFF') {
- return U"SUPPLEMENTARY PRIVATE USE AREA-A";
+ return "SUPPLEMENTARY PRIVATE USE AREA-A";
}
if(_chr >= U'\U00100000' && _chr <= U'\U0010FFFF') {
- return U"SUPPLEMENTARY PRIVATE USE AREA-B";
+ return "SUPPLEMENTARY PRIVATE USE AREA-B";
}
- return U"UNDEFINED IN UNICODE";
+ return "UNDEFINED IN UNICODE";
}
diff --git a/dux/include/dux/str.d/uninm.ii b/dux/include/dux/str.d/uninm.ii
new file mode 100644
index 0000000..6acaec5
--- /dev/null
+++ b/dux/include/dux/str.d/uninm.ii
@@ -0,0 +1,2717 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+[[nodiscard]] dux_attr_const constexpr auto uninm(char32_t const _chr) -> char const * {
+ switch (_chr) {
+ [[unlikely]] default:
+ return "UNDEFINED IN UNICODE";
+ /* BASIC LATIN: */
+ case U'\u0000':
+ return "NULL";
+ case U'\u0001':
+ return "START OF HEADING";
+ case U'\u0002':
+ return "START OF TEXT";
+ case U'\u0003':
+ return "END OF TEXT";
+ case U'\u0004':
+ return "END OF TRANSMISSION";
+ case U'\u0005':
+ return "ENQUIRY";
+ case U'\u0006':
+ return "ACKNOWLEDGE";
+ case U'\u0007':
+ return "BELL";
+ case U'\u0008':
+ return "BACKSPACE";
+ case U'\u0009':
+ return "HORIZONTAL TABULATION";
+ case U'\u000A':
+ return "::new LINE";
+ case U'\u000B':
+ return "VERTICAL TABULATION";
+ case U'\u000C':
+ return "FORM FEED";
+ case U'\u000D':
+ return "CARRIAGE RETURN";
+ case U'\u000E':
+ return "SHIFT OUT";
+ case U'\u000F':
+ return "SHIFT IN";
+ case U'\u0010':
+ return "DATA LINK ESCAPE";
+ case U'\u0011':
+ return "DEVICE CONTROL ONE";
+ case U'\u0012':
+ return "DEVICE CONTROL TWO";
+ case U'\u0013':
+ return "DEVICE CONTROL THREE";
+ case U'\u0014':
+ return "DEVICE CONTROL FOUR";
+ case U'\u0015':
+ return "NEGATIVE ACKNOWLEDGE";
+ case U'\u0016':
+ return "SYNCHRONOUS IDLE";
+ case U'\u0017':
+ return "END OF TRANSMISSION BLOCk";
+ case U'\u0018':
+ return "CANCEL";
+ case U'\u0019':
+ return "END OF MEDIUM";
+ case U'\u001A':
+ return "SUBSTITUTE";
+ case U'\u001B':
+ return "ESCAPE";
+ case U'\u001C':
+ return "FILE SEPERATOR";
+ case U'\u001D':
+ return "GROUP SEPERATOR";
+ case U'\u001E':
+ return "RECORD SEPERATOR";
+ case U'\u001F':
+ return "UNIT SEPERATOR";
+ case U'\u0020':
+ return "SPACE";
+ case U'\u0021':
+ return "EXCLAMATION MARK";
+ case U'\u0022':
+ return "QUOTATION MARK";
+ case U'\u0023':
+ return "NUMBER SIGN";
+ case U'\u0024':
+ return "DOLLAR SIGN";
+ case U'\u0025':
+ return "PERCENT SIGN";
+ case U'\u0026':
+ return "AMPERSAND";
+ case U'\u0027':
+ return "APOSTROPHE";
+ case U'\u0028':
+ return "LEFT PARANTHESIS";
+ case U'\u0029':
+ return "RIGHT PARANTHESIS";
+ case U'\u002A':
+ return "ASTERISK";
+ case U'\u002B':
+ return "PLUS SIGN";
+ case U'\u002C':
+ return "COMMA";
+ case U'\u002D':
+ return "HYPHEN-MINUS";
+ case U'\u002E':
+ return "FULL STOP";
+ case U'\u002F':
+ return "SOLIDUS";
+ case U'\u0030':
+ return "DIGIT ZERO";
+ case U'\u0031':
+ return "DIGIT ONE";
+ case U'\u0032':
+ return "DIGIT TWO";
+ case U'\u0033':
+ return "DIGIT THREE";
+ case U'\u0034':
+ return "DIGIT FOUR";
+ case U'\u0035':
+ return "DIGIT FIVE";
+ case U'\u0036':
+ return "DIGIT SIX";
+ case U'\u0037':
+ return "DIGIT SEVEN";
+ case U'\u0038':
+ return "DIGIT EIGHT";
+ case U'\u0039':
+ return "DIGIT NINE";
+ case U'\u003A':
+ return "COLON";
+ case U'\u003B':
+ return "SEMICOLON";
+ case U'\u003C':
+ return "LESS-THAN SIGN";
+ case U'\u003D':
+ return "EQUALS SIGN";
+ case U'\u003E':
+ return "GREATER-THAN SIGN";
+ case U'\u003F':
+ return "QUESTION MARK";
+ case U'\u0040':
+ return "COMMERCIAL AT";
+ case U'\u0041':
+ return "LATIN CAPITAL LETTER A";
+ case U'\u0042':
+ return "LATIN CAPITAL LETTER B";
+ case U'\u0043':
+ return "LATIN CAPITAL LETTER C";
+ case U'\u0044':
+ return "LATIN CAPITAL LETTER D";
+ case U'\u0045':
+ return "LATIN CAPITAL LETTER E";
+ case U'\u0046':
+ return "LATIN CAPITAL LETTER F";
+ case U'\u0047':
+ return "LATIN CAPITAL LETTER G";
+ case U'\u0048':
+ return "LATIN CAPITAL LETTER H";
+ case U'\u0049':
+ return "LATIN CAPITAL LETTER I";
+ case U'\u004A':
+ return "LATIN CAPITAL LETTER J";
+ case U'\u004B':
+ return "LATIN CAPITAL LETTER K";
+ case U'\u004C':
+ return "LATIN CAPITAL LETTER L";
+ case U'\u004D':
+ return "LATIN CAPITAL LETTER M";
+ case U'\u004E':
+ return "LATIN CAPITAL LETTER N";
+ case U'\u004F':
+ return "LATIN CAPITAL LETTER O";
+ case U'\u0050':
+ return "LATIN CAPITAL LETTER P";
+ case U'\u0051':
+ return "LATIN CAPITAL LETTER Q";
+ case U'\u0052':
+ return "LATIN CAPITAL LETTER R";
+ case U'\u0053':
+ return "LATIN CAPITAL LETTER S";
+ case U'\u0054':
+ return "LATIN CAPITAL LETTER T";
+ case U'\u0055':
+ return "LATIN CAPITAL LETTER ";
+ case U'\u0056':
+ return "LATIN CAPITAL LETTER V";
+ case U'\u0057':
+ return "LATIN CAPITAL LETTER W";
+ case U'\u0058':
+ return "LATIN CAPITAL LETTER X";
+ case U'\u0059':
+ return "LATIN CAPITAL LETTER Y";
+ case U'\u005A':
+ return "LATIN CAPITAL LETTER Z";
+ case U'\u005B':
+ return "LEFT SQUARE BRACKET";
+ case U'\u005C':
+ return "REVERSE SOLIDUS";
+ case U'\u005D':
+ return "RIGHT SQUARE BRACKET";
+ case U'\u005E':
+ return "CIRCUMFLEX ACCENT";
+ case U'\u005F':
+ return "LOW LINE";
+ case U'\u0060':
+ return "GRAVE ACCENT";
+ case U'\u0061':
+ return "LATIN SMALL LETTER A";
+ case U'\u0062':
+ return "LATIN SMALL LETTER B";
+ case U'\u0063':
+ return "LATIN SMALL LETTER C";
+ case U'\u0064':
+ return "LATIN SMALL LETTER D";
+ case U'\u0065':
+ return "LATIN SMALL LETTER E";
+ case U'\u0066':
+ return "LATIN SMALL LETTER F";
+ case U'\u0067':
+ return "LATIN SMALL LETTER G";
+ case U'\u0068':
+ return "LATIN SMALL LETTER H";
+ case U'\u0069':
+ return "LATIN SMALL LETTER I";
+ case U'\u006A':
+ return "LATIN SMALL LETTER J";
+ case U'\u006B':
+ return "LATIN SMALL LETTER K";
+ case U'\u006C':
+ return "LATIN SMALL LETTER L";
+ case U'\u006D':
+ return "LATIN SMALL LETTER M";
+ case U'\u006E':
+ return "LATIN SMALL LETTER N";
+ case U'\u006F':
+ return "LATIN SMALL LETTER O";
+ case U'\u0070':
+ return "LATIN SMALL LETTER P";
+ case U'\u0071':
+ return "LATIN SMALL LETTER Q";
+ case U'\u0072':
+ return "LATIN SMALL LETTER R";
+ case U'\u0073':
+ return "LATIN SMALL LETTER S";
+ case U'\u0074':
+ return "LATIN SMALL LETTER T";
+ case U'\u0075':
+ return "LATIN SMALL LETTER ";
+ case U'\u0076':
+ return "LATIN SMALL LETTER V";
+ case U'\u0077':
+ return "LATIN SMALL LETTER W";
+ case U'\u0078':
+ return "LATIN SMALL LETTER X";
+ case U'\u0079':
+ return "LATIN SMALL LETTER Y";
+ case U'\u007A':
+ return "LATIN SMALL LETTER Z";
+ case U'\u007B':
+ return "LEFT CURLY BRACKET";
+ case U'\u007C':
+ return "VERTICAL LINE";
+ case U'\u007D':
+ return "RIGHT CURLY BRACKET";
+ case U'\u007E':
+ return "TILDE";
+ case U'\u007F':
+ return "::delete";
+ /* LATIN-1 SUPPLEMENT: */
+ case U'\u0080':
+ return "PADDING CHARACTER";
+ case U'\u0081':
+ return "HIGH OCTET PRESET";
+ case U'\u0082':
+ return "BREAK PERMITTED HERE";
+ case U'\u0083':
+ return "NO BREAK HERE";
+ case U'\u0084':
+ return "INDEX";
+ case U'\u0085':
+ return "NEXT LINE";
+ case U'\u0086':
+ return "START OF SELECTED AREA";
+ case U'\u0087':
+ return "END OF SELECTED AREA";
+ case U'\u0088':
+ return "CHARACTER TABULATION SET";
+ case U'\u0089':
+ return "CHARACTER TABULATION WITH JUSTIFICATION";
+ case U'\u008A':
+ return "LINE TABULATION SET";
+ case U'\u008B':
+ return "PARTIAL LINE FORWARD";
+ case U'\u008C':
+ return "PARTIAL LINE BACKWARD";
+ case U'\u008D':
+ return "REVERSE LINE FEED";
+ case U'\u008E':
+ return "SINGLE SHIFT TWO";
+ case U'\u008F':
+ return "SINGLE SHIFT THREE";
+ case U'\u0090':
+ return "DEVICE CONTROL STRING";
+ case U'\u0091':
+ return "PRIVATE USE ONE";
+ case U'\u0092':
+ return "PRIVATE USE TWO";
+ case U'\u0093':
+ return "SET TRANSMIT STATE";
+ case U'\u0094':
+ return "CANCEL CHARACTER";
+ case U'\u0095':
+ return "MESSAGE WAITING";
+ case U'\u0096':
+ return "START OF GUARDED AREA";
+ case U'\u0097':
+ return "END OF GUARDED AREA";
+ case U'\u0098':
+ return "START OF STRING";
+ case U'\u0099':
+ return "SINGLE GRAPHIC CHARACTER INTRODUCER";
+ case U'\u009A':
+ return "SINGLE CHARACTER INTRODUCER";
+ case U'\u009B':
+ return "CONTROL SEQUENCE INTRODUCER";
+ case U'\u009C':
+ return "STRING TERMINATOR";
+ case U'\u009D':
+ return "OPERATING SYSTEM COMMAND";
+ case U'\u009E':
+ return "PRIVACY MESSAGE";
+ case U'\u009F':
+ return "APPLICATION PROGRAM COMMAND";
+ case U'\u00A0':
+ return "NO-BREAK SPACE";
+ case U'\u00A1':
+ return "INVERTED EXCLAMATION MARK";
+ case U'\u00A2':
+ return "CENT SIGN";
+ case U'\u00A3':
+ return "POUND SIGN";
+ case U'\u00A4':
+ return "CURRENCY SIGN";
+ case U'\u00A5':
+ return "YEN SIGN";
+ case U'\u00A6':
+ return "BROKEN BAR";
+ case U'\u00A7':
+ return "SECTION SIGN";
+ case U'\u00A8':
+ return "DIAERESIS";
+ case U'\u00A9':
+ return "COPYRIGHT SIGN";
+ case U'\u00AA':
+ return "FEMININE ORDINAL INDICATOR";
+ case U'\u00AB':
+ return "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK";
+ case U'\u00AC':
+ return "NOT SIGN";
+ case U'\u00AD':
+ return "SOFT HYPHEN";
+ case U'\u00AE':
+ return "REGISTERED SIGN";
+ case U'\u00AF':
+ return "MACRON";
+ case U'\u00B0':
+ return "DEGREE SIGN";
+ case U'\u00B1':
+ return "PLUS MINUS SYMBOL";
+ case U'\u00B2':
+ return "SUPERSCRIPT TWO";
+ case U'\u00B3':
+ return "SUPERSCRIPT THREE";
+ case U'\u00B4':
+ return "ACUTE ACCENT";
+ case U'\u00B5':
+ return "MICRO SIGN";
+ case U'\u00B6':
+ return "PILCROW SIGN";
+ case U'\u00B7':
+ return "MIDDLE DOT";
+ case U'\u00B8':
+ return "CEDILLA";
+ case U'\u00B9':
+ return "SUPERSCRIPT ONE";
+ case U'\u00BA':
+ return "MASCULINE ORDINAL INDICATOR";
+ case U'\u00BB':
+ return "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK";
+ case U'\u00BC':
+ return "VULGAR FRACTION ONE QUARTER";
+ case U'\u00BD':
+ return "VULGAR FRACTION ONE HALF";
+ case U'\u00BE':
+ return "VULGAR FRACTION THREE QUARTERS";
+ case U'\u00BF':
+ return "INVERTED QUESTION MARK";
+ case U'\u00C0':
+ return "LATIN CAPITAL LETTER A WITH GRAVE";
+ case U'\u00C1':
+ return "LATIN CAPITAL LETTER A WITH ACUTE";
+ case U'\u00C2':
+ return "LATIN CAPITAL LETTER A WITH CIRCUMFLEX";
+ case U'\u00C3':
+ return "LATIN CAPITAL LETTER A WITH TILDE";
+ case U'\u00C4':
+ return "LATIN CAPITAL LETTER A WITH DIAERESIS";
+ case U'\u00C5':
+ return "LATIN CAPITAL LETTER A WITH RING ABOVE";
+ case U'\u00C6':
+ return "LATIN CAPITAL LETTER AE";
+ case U'\u00C7':
+ return "LATIN CAPITAL LETTER C WITH CEDILLA";
+ case U'\u00C8':
+ return "LATIN CAPITAL LETTER E WITH GRAVE";
+ case U'\u00C9':
+ return "LATIN CAPITAL LETTER E WITH ACUTE";
+ case U'\u00CA':
+ return "LATIN CAPITAL LETTER E WITH CIRCUMFLEX";
+ case U'\u00CB':
+ return "LATIN CAPITAL LETTER E WITH DIAERESIS";
+ case U'\u00CC':
+ return "LATIN CAPITAL LETTER I WITH GRAVE";
+ case U'\u00CD':
+ return "LATIN CAPITAL LETTER I WITH ACUTE";
+ case U'\u00CE':
+ return "LATIN CAPITAL LETTER I WITH CIRCUMFLEX";
+ case U'\u00CF':
+ return "LATIN CAPITAL LETTER I WITH DIAERESIS";
+ case U'\u00D0':
+ return "LATIN CAPITAL LETTER ETH";
+ case U'\u00D1':
+ return "LATIN CAPITAL LETTER N WITH TILDE";
+ case U'\u00D2':
+ return "LATIN CAPITAL LETTER O WITH GRAVE";
+ case U'\u00D3':
+ return "LATIN CAPITAL LETTER O WITH ACUTE";
+ case U'\u00D4':
+ return "LATIN CAPITAL LETTER O WITH CIRCUMFLEX";
+ case U'\u00D5':
+ return "LATIN CAPITAL LETTER O WITH TILDE";
+ case U'\u00D6':
+ return "LATIN CAPITAL LETTER O WITH DIAERESIS";
+ case U'\u00D7':
+ return "MULTIPLICATION SIGN";
+ case U'\u00D8':
+ return "LATIN CAPITAL LETTER O WITH STROKE";
+ case U'\u00D9':
+ return "LATIN CAPITAL LETTER U WITH GRAVE";
+ case U'\u00DA':
+ return "LATIN CAPITAL LETTER U WITH ACUTE";
+ case U'\u00DB':
+ return "LATIN CAPITAL LETTER U WITH CIRCUMFLEX";
+ case U'\u00DC':
+ return "LATIN CAPITAL LETTER U WITH DIAERESIS";
+ case U'\u00DD':
+ return "LATIN CAPITAL LETTER Y WITH ACUTE";
+ case U'\u00DE':
+ return "LATIN CAPITAL LETTER THORN";
+ case U'\u00DF':
+ return "LATIN SMALL LETTER SHARP S";
+ case U'\u00E0':
+ return "LATIN SMALL LETTER A WITH GRAVE";
+ case U'\u00E1':
+ return "LATIN SMALL LETTER A WITH ACUTE";
+ case U'\u00E2':
+ return "LATIN SMALL LETTER A WITH CIRCUMFLEX";
+ case U'\u00E3':
+ return "LATIN SMALL LETTER A WITH TILDE";
+ case U'\u00E4':
+ return "LATIN SMALL LETTER A WITH DIAERESIS";
+ case U'\u00E5':
+ return "LATIN SMALL LETTER A WITH RING ABOVE";
+ case U'\u00E6':
+ return "LATIN SMALL LETTER AE";
+ case U'\u00E7':
+ return "LATIN SMALL LETTER C WITH CEDILLA";
+ case U'\u00E8':
+ return "LATIN SMALL LETTER E WITH GRAVE";
+ case U'\u00E9':
+ return "LATIN SMALL LETTER E WITH ACUTE";
+ case U'\u00EA':
+ return "LATIN SMALL LETTER E WITH CIRCUMFLEX";
+ case U'\u00EB':
+ return "LATIN SMALL LETTER E WITH DIAERESIS";
+ case U'\u00EC':
+ return "LATIN SMALL LETTER I WITH GRAVE";
+ case U'\u00ED':
+ return "LATIN SMALL LETTER I WITH ACUTE";
+ case U'\u00EE':
+ return "LATIN SMALL LETTER I WITH CIRCUMFLEX";
+ case U'\u00EF':
+ return "LATIN SMALL LETTER I WITH DIAERESIS";
+ case U'\u00F0':
+ return "LATIN SMALL LETTER ETH";
+ case U'\u00F1':
+ return "LATIN SMALL LETTER N WITH TILDE";
+ case U'\u00F2':
+ return "LATIN SMALL LETTER O WITH GRAVE";
+ case U'\u00F3':
+ return "LATIN SMALL LETTER O WITH ACUTE";
+ case U'\u00F4':
+ return "LATIN SMALL LETTER O WITH CIRCUMFLEX";
+ case U'\u00F5':
+ return "LATIN SMALL LETTER O WITH TILDE";
+ case U'\u00F6':
+ return "LATIN SMALL LETTER O WITH DIAERESIS";
+ case U'\u00F7':
+ return "DIVISION SIGN";
+ case U'\u00F8':
+ return "LATIN SMALL LETTER O WITH STROKE";
+ case U'\u00F9':
+ return "LATIN SMALL LETTER U WITH GRAVE";
+ case U'\u00FA':
+ return "LATIN SMALL LETTER U WITH ACUTE";
+ case U'\u00FB':
+ return "LATIN SMALL LETTER U WITH CIRCUMFLEX";
+ case U'\u00FC':
+ return "U WITH TWO DOTS";
+ case U'\u00FD':
+ return "LATIN SMALL LETTER Y WITH ACUTE";
+ case U'\u00FE':
+ return "LATIN SMALL LETTER THORN";
+ case U'\u00FF':
+ return "LATIN SMALL LETTER Y WITH DIAERESIS";
+ /* LATIN EXTENDED-A: */
+ case U'\u0100':
+ return "LATIN CAPITAL LETTER A WITH MACRON";
+ case U'\u0101':
+ return "LATIN SMALL LETTER A WITH MACRON";
+ case U'\u0102':
+ return "LATIN CAPITAL LETTER A WITH BREVE";
+ case U'\u0103':
+ return "LATIN SMALL LETTER A WITH BREVE";
+ case U'\u0104':
+ return "LATIN CAPITAL LETTER A WITH OGONEK";
+ case U'\u0105':
+ return "LATIN SMALL LETTER A WITH OGONEK";
+ case U'\u0106':
+ return "LATIN CAPITAL LETTER C WITH ACUTE";
+ case U'\u0107':
+ return "LATIN SMALL LETTER C WITH ACUTE";
+ case U'\u0108':
+ return "LATIN CAPITAL LETTER C WITH CIRCUMFLEX";
+ case U'\u0109':
+ return "LATIN SMALL LETTER C WITH CIRCUMFLEX";
+ case U'\u010A':
+ return "LATIN CAPITAL LETTER C WITH DOT ABOVE";
+ case U'\u010B':
+ return "LATIN SMALL LETTER C WITH DOT ABOVE";
+ case U'\u010C':
+ return "LATIN CAPITAL LETTER C WITH CARON";
+ case U'\u010D':
+ return "LATIN SMALL LETTER C WITH CARON";
+ case U'\u010E':
+ return "LATIN CAPITAL LETTER D WITH CARON";
+ case U'\u010F':
+ return "LATIN SMALL LETTER D WITH CARON";
+ case U'\u0110':
+ return "LATIN CAPITAL LETTER D WITH STROKE";
+ case U'\u0111':
+ return "LATIN SMALL LETTER D WITH STROKE";
+ case U'\u0112':
+ return "LATIN CAPITAL LETTER E WITH MACRON";
+ case U'\u0113':
+ return "LATIN SMALL LETTER E WITH MACRON";
+ case U'\u0114':
+ return "LATIN CAPITAL LETTER E WITH BREVE";
+ case U'\u0115':
+ return "LATIN SMALL LETTER E WITH BREVE";
+ case U'\u0116':
+ return "LATIN CAPITAL LETTER E WITH DOT ABOVE";
+ case U'\u0117':
+ return "LATIN SMALL LETTER E WITH DOT ABOVE";
+ case U'\u0118':
+ return "LATIN CAPITAL LETTER E WITH OGONEK";
+ case U'\u0119':
+ return "LATIN SMALL LETTER E WITH OGONEK";
+ case U'\u011A':
+ return "LATIN CAPITAL LETTER E WITH CARON";
+ case U'\u011B':
+ return "LATIN SMALL LETTER E WITH CARON";
+ case U'\u011C':
+ return "LATIN CAPITAL LETTER G WITH CIRCUMFLEX";
+ case U'\u011D':
+ return "LATIN SMALL LETTER G WITH CIRCUMFLEX";
+ case U'\u011E':
+ return "LATIN CAPITAL LETTER G WITH BREVE";
+ case U'\u011F':
+ return "LATIN SMALL LETTER G WITH BREVE";
+ case U'\u0120':
+ return "LATIN CAPITAL LETTER G WITH DOT ABOVE";
+ case U'\u0121':
+ return "LATIN SMALL LETTER G WITH DOT ABOVE";
+ case U'\u0122':
+ return "LATIN CAPITAL LETTER G WITH CEDILLA";
+ case U'\u0123':
+ return "LATIN SMALL LETTER G WITH CEDILLA";
+ case U'\u0124':
+ return "LATIN CAPITAL LETTER H WITH CIRCUMFLEX";
+ case U'\u0125':
+ return "LATIN SMALL LETTER H WITH CIRCUMFLEX";
+ case U'\u0126':
+ return "LATIN CAPITAL LETTER H WITH STROKE";
+ case U'\u0127':
+ return "LATIN SMALL LETTER H WITH STROKE";
+ case U'\u0128':
+ return "LATIN CAPITAL LETTER I WITH TILDE";
+ case U'\u0129':
+ return "LATIN SMALL LETTER I WITH TILDE";
+ case U'\u012A':
+ return "LATIN CAPITAL LETTER I WITH MACRON";
+ case U'\u012B':
+ return "LATIN SMALL LETTER I WITH MACRON";
+ case U'\u012C':
+ return "LATIN CAPITAL LETTER I WITH BREVE";
+ case U'\u012D':
+ return "LATIN SMALL LETTER I WITH BREVE";
+ case U'\u012E':
+ return "LATIN CAPITAL LETTER I WITH OGONEK";
+ case U'\u012F':
+ return "LATIN SMALL LETTER I WITH OGONEK";
+ case U'\u0130':
+ return "LATIN CAPITAL LETTER I WITH DOT ABOVE";
+ case U'\u0131':
+ return "LATIN SMALL LETTER DOTLESS I";
+ case U'\u0132':
+ return "LATIN CAPITAL LIGATURE IJ";
+ case U'\u0133':
+ return "LATIN SMALL LIGATURE IJ";
+ case U'\u0134':
+ return "LATIN CAPITAL LETTER J WITH CIRCUMFLEX";
+ case U'\u0135':
+ return "LATIN SMALL LETTER J WITH CIRCUMFLEX";
+ case U'\u0136':
+ return "LATIN CAPITAL LETTER K WITH CEDILLA";
+ case U'\u0137':
+ return "LATIN SMALL LETTER K WITH CEDILLA";
+ case U'\u0138':
+ return "LATIN SMALL LETTER KRA";
+ case U'\u0139':
+ return "LATIN CAPITAL LETTER L WITH ACUTE";
+ case U'\u013A':
+ return "LATIN SMALL LETTER L WITH ACUTE";
+ case U'\u013B':
+ return "LATIN CAPITAL LETTER L WITH CEDILLA";
+ case U'\u013C':
+ return "LATIN SMALL LETTER L WITH CEDILLA";
+ case U'\u013D':
+ return "LATIN CAPITAL LETTER L WITH CARON";
+ case U'\u013E':
+ return "LATIN SMALL LETTER L WITH CARON";
+ case U'\u013F':
+ return "LATIN CAPITAL LETTER L WITH MDDLE DOT";
+ case U'\u0140':
+ return "LATIN SMALL LETTER L WITH MIDDLE DOT";
+ case U'\u0141':
+ return "LATIN CAPITAL LETTER L WITH STROKE";
+ case U'\u0142':
+ return "LATIN SMALL LETTER L WITH STROKE";
+ case U'\u0143':
+ return "LATIN CAPITAL LETTER N WITH ACUTE";
+ case U'\u0144':
+ return "LATIN SMALL LETTER N WITH ACUTE";
+ case U'\u0145':
+ return "LATIN CAPITAL LETTER N WITH CEDILLA";
+ case U'\u0146':
+ return "LATIN SMALL LETTER N WITH CEDILLA";
+ case U'\u0147':
+ return "LATIN CAPITAL LETTER N WITH CARON";
+ case U'\u0148':
+ return "LATIN SMALL LETTER N WITH CARON";
+ case U'\u0149':
+ return "LATIN SMALL LETTER N PRECEDED BY APOSTROPHE";
+ case U'\u014A':
+ return "LATIN CAPITAL LETTER ENG";
+ case U'\u014B':
+ return "LATIN SMALL LETTER ENG";
+ case U'\u014C':
+ return "LATIN CAPITAL LETTER O WITH MACRON";
+ case U'\u014D':
+ return "LATIN SMALL LETTER O WITH MACRON";
+ case U'\u014E':
+ return "LATIN CAPITAL LETTER O WITH BREVE";
+ case U'\u014F':
+ return "LATIN SMALL LETTER O WITH BREVE";
+ case U'\u0150':
+ return "LATIN CAPITAL LETTER O WITH DOUBLE ACUTE";
+ case U'\u0160':
+ return "LATIN CAPITAL LETTER S WITH CARON";
+ case U'\u0170':
+ return "LATIN CAPITAL LETTER U WITH DOUBLE ACUTE";
+ /* LATIN EXTENDED-B: */
+ case U'\u0180':
+ return "LATIN SMALL LETTER B WITH STROKE";
+ case U'\u0190':
+ return "LATIN CAPITAL LETTER OPEN E";
+ case U'\u01A0':
+ return "LATIN CAPITAL LETTER O WITH HORN";
+ case U'\u01B0':
+ return "LATIN SMALL LETTER U WITH HORN";
+ case U'\u01C0':
+ return "LATIN LETTER DENTAL CLICK";
+ case U'\u01D0':
+ return "LATIN SMALL LETTER I WITH CARON";
+ case U'\u01E0':
+ return "LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON";
+ case U'\u01F0':
+ return "LATIN SMALL LETTER J WITH CARON";
+ case U'\u0200':
+ return "LATIN CAPITAL LETTER A WITH DOUBLE GRAVE";
+ case U'\u0210':
+ return "LATIN CAPITAL LETTER R WITH DOUBLE GRAVE";
+ case U'\u0220':
+ return "LATIN CAPITAL LETTER N WITH LONG RIGHT LEG";
+ case U'\u0230':
+ return "LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON";
+ case U'\u0240':
+ return "LATIN SMALL LETTER Z WITH SWASH TAIL";
+ /* IPA EXTENSIONS: */
+ case U'\u0250':
+ return "LATIN SMALL LETTER TURNED A";
+ case U'\u0251':
+ return "LATIN SMALL LETTER ALPHA";
+ case U'\u0252':
+ return "LATIN SMALL LETTER TURNED ALPHA";
+ case U'\u0253':
+ return "LATIN SMALL LETTER B WITH HOOK";
+ case U'\u0254':
+ return "LATIN SMALL LETTER OPEN O";
+ case U'\u0255':
+ return "LATIN SMALL LETTER C WITH CURL";
+ case U'\u0256':
+ return "LATIN SMALL LETTER D WITH TAIL";
+ case U'\u0257':
+ return "LATIN SMALL LETTER D WITH HOOK";
+ case U'\u0258':
+ return "LATIN SMALL LETTER REVERSED E";
+ case U'\u0259':
+ return "LATIN SMALL LETTER SCHWA";
+ case U'\u025A':
+ return "LATIN SMALL LETTER SCHWA WITH HOOK";
+ case U'\u025B':
+ return "LATIN SMALL LETTER OPEN E";
+ case U'\u025C':
+ return "LATIN SMALL LETTER REVERSED OPEN E";
+ case U'\u025D':
+ return "LATIN SMALL LETTER REVERSED OPEN E WITH HOOK";
+ case U'\u025E':
+ return "LATIN SMALL LETTER CLOSED REVERSED OPEN E";
+ case U'\u025F':
+ return "LATIN SMALL LETTER DOTLESS J WITH STROKE";
+ case U'\u0260':
+ return "LATIN SMALL LETTER G WITH HOOK";
+ case U'\u0261':
+ return "LATIN SMALL LETTER SCRIPT G";
+ case U'\u0262':
+ return "LATIN LETTER SMALL CAPITAL G";
+ case U'\u0263':
+ return "LATIN SMALL LETTER GAMMA";
+ case U'\u0264':
+ return "LATIN SMALL LETTER RAMS HORN";
+ case U'\u0265':
+ return "LATIN SMALL LETTER TURNED H";
+ case U'\u0266':
+ return "LATIN SMALL LETTER H WITH HOOK";
+ case U'\u0267':
+ return "LATIN SMALL LETTER HENG WITH HOOK";
+ case U'\u0268':
+ return "LATIN SMALL LETTER I WITH STROKE";
+ case U'\u0269':
+ return "LATIN SMALL LETTER IOTA";
+ case U'\u026A':
+ return "LATIN LETTER SMALL CAPITAL I";
+ case U'\u026B':
+ return "LATIN SMALL LETTER L WITH MIDDLE TILDE";
+ case U'\u026C':
+ return "LATIN SMALL LETTER L WITH BELT";
+ case U'\u026D':
+ return "LATIN SMALL LETTER L WITH RETROFLEX HOOK";
+ case U'\u026E':
+ return "LATIN SMALL LETTER LEZH";
+ case U'\u026F':
+ return "LATIN SMALL LETTER TURNED M";
+ case U'\u0270':
+ return "LATIN SMALL LETTER TURNED M WITH LONG LEG";
+ case U'\u0271':
+ return "LATIN SMALL LETTER M WITH HOOK";
+ case U'\u0272':
+ return "LATIN SMALL LETTER N WITH LEFT HOOK";
+ case U'\u0273':
+ return "LATIN SMALL LETTER N WITH RETROFLEX HOOK";
+ case U'\u0274':
+ return "LATIN LETTER SMALL CAPITAL N";
+ case U'\u0275':
+ return "LATIN SMALL LETTER BARRED O";
+ case U'\u0276':
+ return "LATIN LETTER SMALL CAPITAL OE";
+ case U'\u0277':
+ return "LATIN SMALL LETTER CLOSED OMEGA";
+ case U'\u0278':
+ return "LATIN SMALL LETTER PHI";
+ case U'\u0279':
+ return "LATIN SMALL LETTER TURNED R";
+ case U'\u027A':
+ return "LATIN SMALL LETTER TURNED R WITH LONG LEG";
+ case U'\u027B':
+ return "LATIN SMALL LETTER TURNED R WITH HOOK";
+ case U'\u027C':
+ return "LATIN SMALL LETTER R WITH LONG LEG";
+ case U'\u027D':
+ return "LATIN SMALL LETTER R WITH TAIL";
+ case U'\u027E':
+ return "LATIN SMALL LETTER R WITH FISHHOOK";
+ case U'\u027F':
+ return "LATIN SMALL LETTER REVERSED R WITH FISHHOOK";
+ case U'\u0280':
+ return "LATIN LETTER SMALL CAPITAL R";
+ case U'\u0281':
+ return "LATIN LETTER SMALL CAPITAL INVERTED R";
+ case U'\u0282':
+ return "LATIN SMALL LETTER S WITH HOOK";
+ case U'\u0283':
+ return "LATIN SMALL LETTER ESH";
+ case U'\u0284':
+ return "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK";
+ case U'\u0285':
+ return "LATIN SMALL LETTER SQUAT REVERSED ESH";
+ case U'\u0286':
+ return "LATIN SMALL LETTER SH WITH CURL";
+ case U'\u0287':
+ return "LATIN SMALL LETTER TURNED T";
+ case U'\u0288':
+ return "LATIN SMALL LETTER T WITH RETROFLEX HOOK";
+ case U'\u0289':
+ return "LATIN SMALL LETTER U BAR";
+ case U'\u028A':
+ return "LATIN SMALL LETTER UPSILON";
+ case U'\u028B':
+ return "LATIN SMALL LETTER V WTIH HOOK";
+ case U'\u028C':
+ return "LATIN SMALL LETTER TURNED V";
+ case U'\u028D':
+ return "LATIN SMALL LETTER TURNED W";
+ case U'\u028E':
+ return "LATIN SMALL LETTER TURNED Y";
+ case U'\u028F':
+ return "LATIN LETTER SMALL CAPITAL Y";
+ case U'\u0290':
+ return "LATIN SMALL LETTER Z WITH RETROFLEX HOOK";
+ case U'\u0291':
+ return "LATIN SMALL LETTER Z WITH RETROFLEX";
+ case U'\u0292':
+ return "LATIN SMALL LETTER EZH";
+ case U'\u0293':
+ return "LATIN SMALL LETTER EZH WITH CURL";
+ case U'\u0294':
+ return "LATIN LETTER GLOTTAL STOP";
+ case U'\u0295':
+ return "LATIN LETTER PHARYNGEAL VOICED FRICATIVE";
+ case U'\u0296':
+ return "LATIN LETTER INVERTED GLOTTAL STOP";
+ case U'\u0297':
+ return "LATIN LETTER STRETCHED C";
+ case U'\u0298':
+ return "LATIN LETTER BILABIAL CLICK";
+ case U'\u0299':
+ return "LATIN LETTER SMALL CAPITAL B";
+ case U'\u029A':
+ return "LATIN SMALL LETTER CLOSED OPEN E";
+ case U'\u029B':
+ return "LATIN LETTER SMALL CAPITAL G WITH HOOK";
+ case U'\u029C':
+ return "LATIN LETTER SMALL CAPITAL H";
+ case U'\u029D':
+ return "LATIN SMALL LETTER J WITH CROSSED-TAIL";
+ case U'\u029E':
+ return "LATIN SMALL LETTER TURNED K";
+ case U'\u029F':
+ return "LATIN LETTER SMALL CAPITAL L";
+ case U'\u02A0':
+ return "LATIN SMALL LETTER Q WITH HOOK";
+ case U'\u02A1':
+ return "LATIN LETTER GLOTTAL STOP WITH STROKE";
+ case U'\u02A2':
+ return "LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE";
+ case U'\u02A3':
+ return "LATIN SMALL LETTER DZ DIGRAPH";
+ case U'\u02A4':
+ return "LATIN SMALL LETTER DEZH DIGRAPH";
+ case U'\u02A5':
+ return "LATIN SMALL LETTER DZ DIGRAPH WITH CURL";
+ case U'\u02A6':
+ return "LATIN SMALL LETTER TS DIGRAPH";
+ case U'\u02A7':
+ return "LATIN SMALL LETTER TESH DIGRAPH";
+ case U'\u02A8':
+ return "LATIN SMALL LETTER TC DIGRAPH WITH CURL";
+ case U'\u02A9':
+ return "LATIN SMALL LETTER FENG DIGRAPH";
+ case U'\u02AA':
+ return "LATIN SMALL LETTER LS DIGRAPH";
+ case U'\u02AB':
+ return "LATIN SMALL LETTER LZ DIGRAPH";
+ case U'\u02AC':
+ return "LATIN LETTER BILABIAL PERCUSSIVE";
+ case U'\u02AD':
+ return "LATIN LETTER BIDENTAL PERCUSSIVE";
+ case U'\u02AE':
+ return "LATIN SMALL LETTER TURNED H WITH FISHHOOK";
+ case U'\u02AF':
+ return "LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL";
+ /* SPACING MODIFIER LETTERS: */
+ case U'\u02B0':
+ return "MODIFIER LETTER SMALL H";
+ case U'\u02B1':
+ return "MODIFIER LETTER SMALL H WITH HOOK";
+ case U'\u02B2':
+ return "MODIFIER LETTER SMALL J";
+ case U'\u02B3':
+ return "MODIFIER LETTER SMALL R";
+ case U'\u02B4':
+ return "MODIFIER LETTER SMALL TURNED R";
+ case U'\u02B5':
+ return "MODIFIER LETTER SMALL TURNED R WITH HOOK";
+ case U'\u02B6':
+ return "MODIFIER LETTER SMALL CAPITAL INVERTED R";
+ case U'\u02B7':
+ return "MODIFIER LETTER SMALL W";
+ case U'\u02B8':
+ return "MODIFIER LETTER SMALL Y";
+ case U'\u02B9':
+ return "MODIFIER LETTER PRIME";
+ case U'\u02BA':
+ return "MODIFIER LETTER DOUBLE PRIME";
+ case U'\u02BB':
+ return "MODIFIER LETTER TURNED COMMA";
+ case U'\u02BC':
+ return "MODIFIER LETTER APOSTROPHE";
+ case U'\u02BD':
+ return "MODIFIER LETTER REVERSED COMMA";
+ case U'\u02BE':
+ return "MODIFIER LETTER RIGHT HALF RING";
+ case U'\u02BF':
+ return "MODIFIER LETTER LEFT HALF RING";
+ case U'\u02C0':
+ return "MODIFIER LETTER GLOTTAL STOP";
+ case U'\u02C1':
+ return "MODIFIER LETTER REVERSED GLOTTAL STOP";
+ case U'\u02C2':
+ return "MODIFIER LETTER LEFT ARROWHEAD";
+ case U'\u02C3':
+ return "MODIFIER LETTER RIGHT ARROWHEAD";
+ case U'\u02C4':
+ return "MODIFIER LETTER UP ARROWHEAD";
+ case U'\u02C5':
+ return "MODIFIER LETTER DOWN ARROWHEAD";
+ case U'\u02C6':
+ return "MODIFIER LETTER CIRCUMFLEX";
+ case U'\u02C7':
+ return "CARON";
+ case U'\u02C8':
+ return "MODIFIER LETTER VERTICAL LINE";
+ case U'\u02C9':
+ return "MODIFIER LETTER MACRON";
+ case U'\u02CA':
+ return "MODIFIER LETTER ACUTE ACCENT";
+ case U'\u02CB':
+ return "MODIFIER LETTER GRAVE ACCENT";
+ case U'\u02CC':
+ return "MODIFIER LETTER LOW VERTICAL LINE";
+ case U'\u02CD':
+ return "MODIFIER LETTER LOW MACRON";
+ case U'\u02CE':
+ return "MODIFIER LETTER LOW GRAVE ACCENT";
+ case U'\u02CF':
+ return "MODIFIER LETTER LOW ACUTE ACCENT";
+ case U'\u02D0':
+ return "MODIFIER LETTER TRIANGULAR COLON";
+ case U'\u02D1':
+ return "MODIFIER LETTER HALF TRIANGULAR COLON";
+ case U'\u02D2':
+ return "MODIFIER LETTER CENTRED RIGHT HALF RING";
+ case U'\u02D3':
+ return "MODIFIER LETTER CENTRED LEFT HALF RING";
+ case U'\u02D4':
+ return "MODIFIER LETTER UP TACK";
+ case U'\u02D5':
+ return "MODIFIER LETTER DOWN TACK";
+ case U'\u02D6':
+ return "MODIFIER LETTER PLUS SIGN";
+ case U'\u02D7':
+ return "MODIFIER LETTER MINUS SIGN";
+ case U'\u02D8':
+ return "BREVE";
+ case U'\u02D9':
+ return "DOT ABOVE";
+ case U'\u02DA':
+ return "RING ABOVE";
+ case U'\u02DB':
+ return "OGONEK";
+ case U'\u02DC':
+ return "SMALL TILDE";
+ case U'\u02DD':
+ return "DOUBLE ACUTE ACCENT";
+ case U'\u02DE':
+ return "MODIFIER LETTER RHOTIC HOOK";
+ case U'\u02DF':
+ return "MODIFIER LETTER CROSS ACCENT";
+ case U'\u02E0':
+ return "MODIFIER LETTER SMALL GAMMA";
+ case U'\u02E1':
+ return "MODIFIER LETTER SMALL L";
+ case U'\u02E2':
+ return "MODIFIER LETTER SMALL S";
+ case U'\u02E3':
+ return "MODIFIER LETTER SMALL X";
+ case U'\u02E4':
+ return "MODIFIER LETTER SMALL REVERSED GLOTTAL STOP";
+ case U'\u02E5':
+ return "MODIFIER LETTER EXTRA-HIGH TONE BAR";
+ case U'\u02E6':
+ return "MODIFIER LETTER HIGH TONE BAR";
+ case U'\u02E7':
+ return "MODIFIER LETTER MID TONE BAR";
+ case U'\u02E8':
+ return "MODIFIER LETTER LOW TONE BAR";
+ case U'\u02E9':
+ return "MODIFIER LETTER EXTRA-LOW TONE BAR";
+ case U'\u02EA':
+ return "MODIFIER LETTER YIN DEPARTING TONE MARK";
+ case U'\u02EB':
+ return "MODIFIER LETTER YANG DEPARTING TONE MARK";
+ case U'\u02EC':
+ return "MODIFIER LETTER VOICING";
+ case U'\u02ED':
+ return "MODIFIER LETTER UNASPIRATED";
+ case U'\u02EE':
+ return "MODIFIER LETTER DOUBLE APOSTROPHE";
+ case U'\u02EF':
+ return "MODIFIER LETTER LOW DOWN ARROWHEAD";
+ case U'\u02F0':
+ return "MODIFIER LETTER LOW UP ARROWHEAD";
+ case U'\u02F1':
+ return "MODIFIER LETTER LOW LEFT ARROWHEAD";
+ case U'\u02F2':
+ return "MODIFIER LETTER LOW RIGHT ARROWHEAD";
+ case U'\u02F3':
+ return "MODIFIER LETTER LOW RING";
+ case U'\u02F4':
+ return "MODIFIER LETTER MIDDLE GRAVE ACCENT";
+ case U'\u02F5':
+ return "MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT";
+ case U'\u02F6':
+ return "MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT";
+ case U'\u02F7':
+ return "MODIFIER LETTER LOW TILDE";
+ case U'\u02F8':
+ return "MODIFIER LETTER RAISED COLON";
+ case U'\u02F9':
+ return "MODIFIER LETTER BEGIN HIGH TONE";
+ case U'\u02FA':
+ return "MODIFIER LETTER END HIGH TONE";
+ case U'\u02FB':
+ return "MODIFIER LETTER BEGIN LOW TONE";
+ case U'\u02FC':
+ return "MODIFIER LETTER END LOW TONE";
+ case U'\u02FD':
+ return "MODIFIER LETTER SHELF";
+ case U'\u02FE':
+ return "MODIFIER LETTER OPEN SHELF";
+ case U'\u02FF':
+ return "MODIFIER LETTER LOW LEFT ARROWHEAD";
+ /* COMBINING DIACRITICAL MARKS: */
+ case U'\u0300':
+ return "COMBINING GRAVE ACCENT";
+ case U'\u0301':
+ return "COMBINING ACUTE ACCENT";
+ case U'\u0302':
+ return "COMBINING CIRCUMFLEX ACCENT";
+ case U'\u0303':
+ return "COMBINING TILDE";
+ case U'\u0304':
+ return "COMBINING MACRON";
+ case U'\u0305':
+ return "COMBINING OVERLINE";
+ case U'\u0306':
+ return "COMBINING BREVE";
+ case U'\u0307':
+ return "COMBINING DOT ABOVE";
+ case U'\u0308':
+ return "COMBINING DIAERESIS";
+ case U'\u0309':
+ return "COMBINING HOOK ABOVE";
+ case U'\u030A':
+ return "COMBINING RING ABOVE";
+ case U'\u030B':
+ return "COMBINING DOUBLE ACUTE ACCENT";
+ case U'\u030C':
+ return "COMBINING CARON";
+ case U'\u030D':
+ return "COMBINING VERTICAL LINE ABOVE";
+ case U'\u030E':
+ return "COMBINING DOUBLE VERTICAL LINE ABOVE";
+ case U'\u030F':
+ return "COMBINING DOUBLE GRAVE ACCENT";
+ case U'\u0310':
+ return "COMBINING CANDRABIND";
+ case U'\u0311':
+ return "COMBINING INVERTED BREVE";
+ case U'\u0312':
+ return "COMBINING TURNED COMMA ABOVE";
+ case U'\u0313':
+ return "COMBINING COMMA ABOVE";
+ case U'\u0314':
+ return "COMBINING REVERSED COMMA ABOVE";
+ case U'\u0315':
+ return "COMBINING COMMA ABOVE RIGHT";
+ case U'\u0316':
+ return "COMBINING GRAVE ACCENT BELOW";
+ case U'\u0317':
+ return "COMBINING ACUTE ACCENT BELOW";
+ case U'\u0318':
+ return "COMBINING LEFT TACK BELOW";
+ case U'\u0319':
+ return "COMBINING RIGHT TACK BELOW";
+ case U'\u031A':
+ return "COMBINING LEFT ANGLE ABOVE";
+ case U'\u031B':
+ return "COMBINING HORN";
+ case U'\u031C':
+ return "COMBINING LEFT HALF RING BELOW";
+ case U'\u031D':
+ return "COMBINING UP TACK BELOW";
+ case U'\u031E':
+ return "COMBINING DOWN TACK BELOW";
+ case U'\u031F':
+ return "COMBINING PLUS SIGN BELOW";
+ case U'\u0320':
+ return "COMBINING MINUS SIGN BELOW";
+ case U'\u0321':
+ return "COMBINING PALATALIZED HOOK BELOW";
+ case U'\u0322':
+ return "COMBINING RETROFLEX HOOK BELOW";
+ case U'\u0323':
+ return "COMBINING DOT BELOW";
+ case U'\u0324':
+ return "COMBINING DIAERESIS BELOW";
+ case U'\u0325':
+ return "COMBINING RING BELOW";
+ case U'\u0326':
+ return "COMBINING COMMA BELOW";
+ case U'\u0327':
+ return "COMBINING CEDILLA";
+ case U'\u0328':
+ return "COMBINING OGONEK";
+ case U'\u0329':
+ return "COMBINING VERTICAL LINE BELOW";
+ case U'\u032A':
+ return "COMBINING BRDIGE BELOW";
+ case U'\u032B':
+ return "COMBINING INVERTED DOUBLE ARCH BELOW";
+ case U'\u032C':
+ return "COMBINING CARON BELOW";
+ case U'\u032D':
+ return "COMBINING CIRCUMFLEX ACCENT BELOW";
+ case U'\u032E':
+ return "COMBINING BREVE BELOW";
+ case U'\u032F':
+ return "COMBINING INVERTED BREVE BELOW";
+ case U'\u0330':
+ return "COMBINING TILDE BELOW";
+ case U'\u0331':
+ return "COMBINING MACRON BELOW";
+ case U'\u0332':
+ return "COMBINING LOW LINE";
+ case U'\u0333':
+ return "COMBINING DOUBLE LOW LINE";
+ case U'\u0334':
+ return "COMBINING TILDE OVERLAY";
+ case U'\u0335':
+ return "COMBINING SHORT STROKE OVERLAY";
+ case U'\u0336':
+ return "COMBINING LONG STROKE OVERLAY";
+ case U'\u0337':
+ return "COMBINING SHORT SOLIDUS OVERLAY";
+ case U'\u0338':
+ return "COMBINING LONG SOLIDUS OVERLAY";
+ case U'\u0339':
+ return "COMBINING RIGHT HALF RING BELOW";
+ case U'\u033A':
+ return "COMBINING INVERTED BRIDGE BELOW";
+ case U'\u033B':
+ return "COMBINING SQUARE BELOW";
+ case U'\u033C':
+ return "COMBINING SEAGULL BELOW";
+ case U'\u033D':
+ return "COMBINING X ABOVE";
+ case U'\u033E':
+ return "COMBINING VERTICAL TILDE";
+ case U'\u033F':
+ return "COMBINING DOUBLE OVERLINE";
+ case U'\u0340':
+ return "COMBINING GRAVE TONE MARK";
+ case U'\u0341':
+ return "COMBINING ACUTE TONE MARK";
+ case U'\u0342':
+ return "COMBINING GREEK PERISPOMENI";
+ case U'\u0343':
+ return "COMBINING GREEK KORONIS";
+ case U'\u0344':
+ return "COMBINING GREEK DIALYTIKA TONOS";
+ case U'\u0345':
+ return "COMBINING GREEK YPOGEGRAMMENI";
+ case U'\u0346':
+ return "COMBINING BRIDGE ABOVE";
+ case U'\u0347':
+ return "COMBINING EQUALS SIGN BELOW";
+ case U'\u0348':
+ return "COMBINING DOUBLE VERTICAL LINE BELOW";
+ case U'\u0349':
+ return "COMBINING LEFT ANGLE BELOW";
+ case U'\u034A':
+ return "COMBINING NOT TILDE ABOVE";
+ case U'\u034B':
+ return "COMBINING HOMOTHETIC ABOVE";
+ case U'\u034C':
+ return "COMBINING ALMOST EQUAL TO ABOVE";
+ case U'\u034D':
+ return "COMBINING LEFT RIGHT ARROW BELOW";
+ case U'\u034E':
+ return "COMBINING UPWARDS ARROW BELOW";
+ case U'\u034F':
+ return "COMBINING GRAPHEME JOINER";
+ case U'\u0350':
+ return "COMBINING RIGHT ARROWHEAD ABOVE";
+ case U'\u0351':
+ return "COMBINING LEFT HALF RING ABOVE";
+ case U'\u0352':
+ return "COMBINING FERMATA";
+ case U'\u0353':
+ return "COMBINING X BELOW";
+ case U'\u0354':
+ return "COMBINING LEFT ARROWHEAD BELOW";
+ case U'\u0355':
+ return "COMBINING RIGHT ARROWHEAD BELOW";
+ case U'\u0356':
+ return "COMBINING RIGHT ARROWHEAD AND UP ARROWHEAD BELOW";
+ case U'\u0357':
+ return "COMBINING RIGHT HALF RING ABOVE";
+ case U'\u0358':
+ return "COMBINING DOT ABOVE RIGHT";
+ case U'\u0359':
+ return "COMBINING ASTERISK BELOW";
+ case U'\u035A':
+ return "COMBINING DOUBLE RING BELOW";
+ case U'\u035B':
+ return "COMBINING ZIGZAG ABOVE";
+ case U'\u035C':
+ return "COMBINING DOUBLE BREVE BELOW";
+ case U'\u035D':
+ return "COMBINING DOUBLE BREVE";
+ case U'\u035E':
+ return "COMBINING DOUBLE MACRON";
+ case U'\u035F':
+ return "COMBINING DOUBLE MACRON BELOW";
+ case U'\u0360':
+ return "COMBINING DOUBLE TILDE";
+ case U'\u0361':
+ return "COMBINING DOUBLE INVERTED BREVE";
+ case U'\u0362':
+ return "COMBINING DOUBLE RIGHTWARDS ARROW BELOW";
+ case U'\u0363':
+ return "COMBINING LATIN SMALL LETTER A";
+ case U'\u0364':
+ return "COMBINING LATIN SMALL LETTER E";
+ case U'\u0365':
+ return "COMBINING LATIN SMALL LETTER I";
+ case U'\u0366':
+ return "COMBINING LATIN SMALL LETTER O";
+ case U'\u0367':
+ return "COMBINING LATIN SMALL LETTER ";
+ case U'\u0368':
+ return "COMBINING LATIN SMALL LETTER C";
+ case U'\u0369':
+ return "COMBINING LATIN SMALL LETTER D";
+ case U'\u036A':
+ return "COMBINING LATIN SMALL LETTER H";
+ case U'\u036B':
+ return "COMBINING LATIN SMALL LETTER M";
+ case U'\u036C':
+ return "COMBINING LATIN SMALL LETTER R";
+ case U'\u036D':
+ return "COMBINING LATIN SMALL LETTER T";
+ case U'\u036E':
+ return "COMBINING LATIN SMALL LETTER V";
+ case U'\u036F':
+ return "COMBINING LATIN SMALL LETTER X";
+ /* GREEK AND COPTIC: */
+ case U'\u0370':
+ return "GREEK CAPITAL LETTER HETA";
+ case U'\u0371':
+ return "GREEK SMALL LETTER HETA";
+ case U'\u0372':
+ return "GREEK CAPITAL LETTER ARCHAIC SAMPI";
+ case U'\u0373':
+ return "GREEK SMALL LETTER ARCHAIC SAMPI";
+ case U'\u0374':
+ return "GREEK NUMERAL SIGN";
+ case U'\u0375':
+ return "GREEK LOWER NUMERAL SIGN";
+ case U'\u0376':
+ return "GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA";
+ case U'\u0377':
+ return "GREEK SMALL LETTER PAMPHYLIAN DIGAMMA";
+ case U'\u037A':
+ return "GREEK YPOGEGRAMMENI";
+ case U'\u037B':
+ return "GREEK SMALL REVERSED LUNATE SIGMA SYMBOL";
+ case U'\u037C':
+ return "GREEK SMALL DOTTED LUNATE SIGMA SYMBOL";
+ case U'\u037D':
+ return "GREEK SMALL REVERSED DOTTED LUNATE SIGMAL SYMBOL";
+ case U'\u037E':
+ return "GREEK QUESTION MARK";
+ case U'\u037F':
+ return "GREEK CAPITAL LETTER YOT";
+ case U'\u0384':
+ return "GREEK TONOS";
+ case U'\u0385':
+ return "GREEK DIALYTIKA TONOS";
+ case U'\u0386':
+ return "GREEK CAPITAL LETTER ALPHA WITH TONOS";
+ case U'\u0387':
+ return "GREEK ANO TELEIA";
+ case U'\u0388':
+ return "GREEK CAPITAL LETTER EPSILON WITH TONOS";
+ case U'\u0389':
+ return "GREEK CAPITAL LETTER ETA WITH TONOS";
+ case U'\u038A':
+ return "GREEK CAPITAL LETTER IOTA WITH TONOS";
+ case U'\u038C':
+ return "GREEK CAPITAL LETTER OMICRON WITH TONOS";
+ case U'\u038E':
+ return "GREEK CAPITAL LETTER USPILON WITH TONOS";
+ case U'\u038F':
+ return "GREEK CAPITAL LETTER OMEGA WITH TONOS";
+ case U'\u0390':
+ return "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS";
+ case U'\u0391':
+ return "GREEK CAPITAL LETTER ALPHA";
+ case U'\u0392':
+ return "GREEK CAPITAL LETTER BETA";
+ case U'\u0393':
+ return "GREEK CAPITAL LETTER GAMMA";
+ case U'\u0394':
+ return "GREEK CAPITAL LETTER DELTA";
+ case U'\u0395':
+ return "GREEK CAPITAL LETTER EPSILON";
+ case U'\u0396':
+ return "GREEK CAPITAL LETTER ZETA";
+ case U'\u0397':
+ return "GREEK CAPITAL LETTER ETA";
+ case U'\u0398':
+ return "GREEK CAPITAL LETTER THETA";
+ case U'\u0399':
+ return "GREEK CAPITAL LETTER IOTA";
+ case U'\u039A':
+ return "GREEK CAPITAL LETTER KAPPA";
+ case U'\u039B':
+ return "GREEK CAPITAL LETTER LAMBDA";
+ case U'\u039C':
+ return "GREEK CAPITAL LETTER M";
+ case U'\u039D':
+ return "GREEK CAPITAL LETTER N";
+ case U'\u039E':
+ return "GREEK CAPITAL LETTER XI";
+ case U'\u039F':
+ return "GREEK CAPITAL LETTER OMICRON";
+ case U'\u03A0':
+ return "GREEK CAPITAL LETTER PI";
+ case U'\u03A1':
+ return "GREEK CAPITAL LETTER RHO";
+ case U'\u03A3':
+ return "GREEK CAPITAL LETTER SIGMA";
+ case U'\u03A4':
+ return "GREEK CAPITAL LETTER TA";
+ case U'\u03A5':
+ return "GREEK CAPITAL LETTER UPSILON";
+ case U'\u03A6':
+ return "GREEK CAPITAL LETTER PHI";
+ case U'\u03A7':
+ return "GREEK CAPITAL LETTER CHI";
+ case U'\u03A8':
+ return "GREEK CAPITAL LETTER PSI";
+ case U'\u03A9':
+ return "GREEK CAPITAL LETTER OMEGA";
+ case U'\u03AA':
+ return "GREEK CAPITAL LETTER IOTA WITH DIALYTIKA";
+ case U'\u03AB':
+ return "GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA";
+ case U'\u03AC':
+ return "GREEK SMALL LETTER ALPHA WITH TONOS";
+ case U'\u03AD':
+ return "GREEK SMALL LETTER EPSILON WITH TONOS";
+ case U'\u03AE':
+ return "GREEK SMALL LETTER ETA WITH TONOS";
+ case U'\u03AF':
+ return "GREEK SMALL LETTER IOTA WITH TONOS";
+ case U'\u03B0':
+ return "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS";
+ case U'\u03B1':
+ return "GREEK SMALL LETTER ALPHA";
+ case U'\u03B2':
+ return "GREEK SMALL LETTER BETA";
+ case U'\u03B3':
+ return "GREEK SMALL LETTER GAMMA";
+ case U'\u03B4':
+ return "GREEK SMALL LETTER DELTA";
+ case U'\u03B5':
+ return "GREEK SMALL LETTER EPSILON";
+ case U'\u03B6':
+ return "GREEK SMALL LETTER ZETA";
+ case U'\u03B7':
+ return "GREEK SMALL LETTER ETA";
+ case U'\u03B8':
+ return "GREEK SMALL LETTER THETA";
+ case U'\u03B9':
+ return "GREEK SMALL LETTER IOTA";
+ case U'\u03BA':
+ return "GREEK SMALL LETTER KAPPA";
+ case U'\u03BB':
+ return "GREEK SMALL LETTER LAMBDA";
+ case U'\u03BC':
+ return "GREEK SMALL LETTER M";
+ case U'\u03BD':
+ return "GREEK SMALL LETTER N";
+ case U'\u03BE':
+ return "GREEK SMALL LETTER XI";
+ case U'\u03BF':
+ return "GREEK SMALL LETTER OMICRON";
+ case U'\u03C0':
+ return "GREEK SMALL LETTER PI";
+ case U'\u03C1':
+ return "GREEK SMALL LETTER RHO";
+ case U'\u03C2':
+ return "GREEK SMALL LETTER FINAL SIGMA";
+ case U'\u03C3':
+ return "GREEK SMALL LETTER SIGMA";
+ case U'\u03C4':
+ return "GREEK SMALL LETTER TA";
+ case U'\u03C5':
+ return "GREEK SMALL LETTER UPSILON";
+ case U'\u03C6':
+ return "GREEK SMALL LETTER PHI";
+ case U'\u03C7':
+ return "GREEK SMALL LETTER CHI";
+ case U'\u03C8':
+ return "GREEK SMALL LETTER PSI";
+ case U'\u03C9':
+ return "GREEK SMALL LETTER OMEGA";
+ case U'\u03CA':
+ return "GREEK SMALL LETTER IOTA WITH DIALYTIKA";
+ case U'\u03CB':
+ return "GREEK SMALL LETTER UPSILON WITH DIALYTIKA";
+ case U'\u03CC':
+ return "GREEK SMALL LETTER OMICRON WITH TONOS";
+ case U'\u03CD':
+ return "GREEK SMALL LETTER UPSILON WITH TONOS";
+ case U'\u03CE':
+ return "GREEK SMALL LETTER OMEGA WITH TONOS";
+ case U'\u03CF':
+ return "GREEK CAPITAL KAI SYMBOL";
+ case U'\u03D0':
+ return "GREEK BETA SYMBOL";
+ case U'\u03D1':
+ return "GREEK THETA SYMBOL";
+ case U'\u03D2':
+ return "GREEK UPSILON WITH HOOK SYMBOL";
+ case U'\u03D3':
+ return "GREEK UPSILON WITH ACUTE AND HOOK SYMBOL";
+ case U'\u03D4':
+ return "GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL";
+ case U'\u03D5':
+ return "GREEK PHI SYMBOL";
+ case U'\u03D6':
+ return "GREEK PI SYMBOL";
+ case U'\u03D7':
+ return "GREEK KAI SYMBOL";
+ case U'\u03D8':
+ return "GREEK LETTER ARCHAIC KOPPA";
+ case U'\u03D9':
+ return "GREEK SMALL LETTER ARCHAIC KOPPA";
+ case U'\u03DA':
+ return "GREEK LETTER STIGMA";
+ case U'\u03DB':
+ return "GREEK SMALL LETTER STIGMA";
+ case U'\u03DC':
+ return "GREEK LETTER DIGAMMA";
+ case U'\u03DD':
+ return "GREEK SMALL LETTER DIGAMMA";
+ case U'\u03DE':
+ return "GREEK LETTER KOPPA";
+ case U'\u03DF':
+ return "GREEK SMALL LETTER KOPPA";
+ case U'\u03E0':
+ return "GREEK LETTER SAMPI";
+ case U'\u03F0':
+ return "GREEK KAPPA SYMBOL";
+ /* HEBREW: */
+ case U'\u05D0':
+ return "HEBREW LETTER ALEF";
+ case U'\u05D1':
+ return "HEBREW LETTER BET";
+ case U'\u05D2':
+ return "HEBREW LETTER GIMEL";
+ case U'\u05D3':
+ return "HEBREW LETTER DALET";
+ case U'\u05D4':
+ return "HEBREW LETTER HE";
+ case U'\u05D5':
+ return "HEBREW LETTER VAV";
+ case U'\u05D6':
+ return "HEBREW LETTER ZAYIN";
+ case U'\u05D7':
+ return "HEBREW LETTER HET";
+ case U'\u05D8':
+ return "HEBREW LETTER TET";
+ case U'\u05D9':
+ return "HEBREW LETTER YOD";
+ case U'\u05DA':
+ return "HEBREW LETTER FINAL KAF";
+ case U'\u05DB':
+ return "HEBREW LETTER KAF";
+ case U'\u05DC':
+ return "HEBREW LETTER LAMED";
+ case U'\u05DD':
+ return "HEBREW LETTER FINAL MEM";
+ case U'\u05DE':
+ return "HEBREW LETTER MEM";
+ case U'\u05DF':
+ return "HEBREW LETTER FINAL NUN";
+ case U'\u05E0':
+ return "HEBREW LETTER NUN";
+ case U'\u05E1':
+ return "HEBREW LETTER SAMEKH";
+ case U'\u05E2':
+ return "HEBREW LETTER AYIN";
+ case U'\u05E3':
+ return "HEBREW LETTER FINAL PE";
+ case U'\u05E4':
+ return "HEBREW LETTER PE";
+ case U'\u05E5':
+ return "HEBREW LETTER FINAL TSADI";
+ case U'\u05E6':
+ return "HEBREW LETTER TSADI";
+ case U'\u05E7':
+ return "HEBREW LETTER QOF";
+ case U'\u05E8':
+ return "HEBREW LETTER RESH";
+ case U'\u05E9':
+ return "HEBREW LETTER SHIN";
+ case U'\u05EA':
+ return "HEBREW LETTER TAV";
+ case U'\u05EF':
+ return "HEBREW YOD TRIANGLE";
+ /* CYRILLIC: */
+ case U'\u0400':
+ return "CYRILLIC CAPITAL LETTER LE WITH GRAVE";
+ case U'\u0401':
+ return "CYRILLIC CAPITAL LETTER LO";
+ case U'\u0402':
+ return "CYRILLIC CAPITAL LETTER DJE";
+ case U'\u0403':
+ return "CYRILLIC CAPITAL LETTER GJE";
+ case U'\u0404':
+ return "CYRILLIC CAPITAL LETTER UKRAINIAN LE";
+ case U'\u0405':
+ return "CYRILLIC CAPITAL LETTER DZE";
+ case U'\u0406':
+ return "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I";
+ case U'\u0407':
+ return "CYRILLIC CAPITAL LETTER YI";
+ case U'\u0408':
+ return "CYRILLIC CAPITAL LETTER JE";
+ case U'\u0409':
+ return "CYRILLIC CAPITAL LETTER LJE";
+ case U'\u040A':
+ return "CYRILLIC CAPITAL LETTER NJE";
+ case U'\u040B':
+ return "CYRILLIC CAPITAL LETTER TSHE";
+ case U'\u040C':
+ return "CYRILLIC CAPITAL LETTER KJE";
+ case U'\u040D':
+ return "CYRILLIC CAPITAL LETTER I WITH GRAVE";
+ case U'\u040E':
+ return "CYRILLIC CAPITAL LETTER SHORT ";
+ case U'\u040F':
+ return "CYRILLIC CAPITAL LETTER DZHE";
+ case U'\u0410':
+ return "CYRILLIC CAPITAL LETTER A";
+ case U'\u0420':
+ return "CYRILLIC CAPITAL LETTER ER";
+ case U'\u0430':
+ return "CYRILLIC SMALL LETTER A";
+ case U'\u0440':
+ return "CYRILLIC SMALL LETTER ER";
+ case U'\u0450':
+ return "CYRILLIC SMALL LETTER LE WITH GRAVE";
+ case U'\u0460':
+ return "CYRILLIC CAPITAL LETTER OMEGA";
+ case U'\u0470':
+ return "CYRILLIC CAPITAL LETTER PSI";
+ case U'\u0480':
+ return "CYRILLIC CAPITAL LETTER KOPPA";
+ case U'\u0490':
+ return "CYRILLIC CAPITAL LETTER GHE WITH UPTURN";
+ case U'\u04A0':
+ return "CYRILLIC CAPITAL LETTER BASHKIR KA";
+ case U'\u04B0':
+ return "CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE";
+ case U'\u04C0':
+ return "CYRILLIC LETTER PALOCHKA";
+ case U'\u04D0':
+ return "CYRILLIC CAPITAL LETTER A WITH BREVE";
+ case U'\u04E0':
+ return "CYRILLIC CAPITAL LETTER ABKHASIAN DZE";
+ case U'\u04F0':
+ return "CYRILLIC CAPITAL LETTER U WITH DIAERESIS";
+ /* SYRIAC SUPPLEMENT: */
+ case U'\u0860':
+ return "SYRIAC LETTER MALAYALAM NGA";
+ case U'\u0861':
+ return "SYRIAC LETTER MALAYALAM JA";
+ case U'\u0862':
+ return "SYRIAC LETTER MALAYALAM NYA";
+ case U'\u0863':
+ return "SYRIAC LETTER MALAYALAM TTA";
+ case U'\u0864':
+ return "SYRIAC LETTER MALAYALAM NNA";
+ case U'\u0865':
+ return "SYRIAC LETTER MALAYALAM NNNA";
+ case U'\u0866':
+ return "SYRIAC LETTER MALAYALAM BHA";
+ case U'\u0867':
+ return "SYRIAC LETTER MALAYALAM RA";
+ case U'\u0868':
+ return "SYRIAC LETTER MALAYALAM LLA";
+ case U'\u0869':
+ return "SYRIAC LETTER MALAYALAM LLLA";
+ case U'\u086A':
+ return "SYRIAC LETTER MALAYALAM SSA";
+ /* RUNIC: */
+ case U'\u16A0':
+ return "RUNIC LETTER FEHU FEOH FE F";
+ case U'\u16A1':
+ return "RUNIC LETTER V";
+ case U'\u16A2':
+ return "RUNIC LETTER UR) UR ";
+ case U'\u16A3':
+ return "RUNIC LETTER YR";
+ case U'\u16A4':
+ return "RUNIC LETTER Y";
+ case U'\u16A5':
+ return "RUNIC LETTER W";
+ case U'\u16A6':
+ return "RUNIC LETTER THURISAZ THURS THORN";
+ case U'\u16A7':
+ return "RUNIC LETTER ETH";
+ case U'\u16A8':
+ return "RUNIC LETTER ANS) A";
+ case U'\u16A9':
+ return "RUNIC LETTER OS O";
+ case U'\u16AA':
+ return "RUNIC LETTER AC A";
+ case U'\u16AB':
+ return "RUNIC LETTER AESC";
+ case U'\u16AC':
+ return "RUNIC LETTER LONG-BRANCHED-OSS O";
+ case U'\u16AD':
+ return "RUNIC LETTER SHORT-TWIG-OSS O";
+ case U'\u16AE':
+ return "RUNIC LETTER O";
+ case U'\u16AF':
+ return "RUNIC LETTER OE";
+ case U'\u16B0':
+ return "RUNIC LETTER ON";
+ case U'\u16C0':
+ return "RUNIC LETTER DOTTED-N";
+ case U'\u16D0':
+ return "RUNIC LETTER SHORT-TWIG-TYR T";
+ case U'\u16E0':
+ return "RUNIC LETTER EAR";
+ case U'\u16F0':
+ return "RUNIC BELGTHOR SYMBOL";
+ /* CYRILLIC EXTENDED C: */
+ case U'\u1C80':
+ return "CYRILLIC SMALL LETTER ROUNDED VE";
+ case U'\u1C81':
+ return "CYRILLIC SMALL LETTER LONG-LEGGED DE";
+ case U'\u1C82':
+ return "CYRILLIC SMALL LETTER NARROW O";
+ case U'\u1C83':
+ return "CYRILLIC SMALL LETTER WIDE ES";
+ case U'\u1C84':
+ return "CYRILLIC SMALL LETTER TALL TE";
+ case U'\u1C85':
+ return "CYRILLIC SMALL LETTER THREE-LEGGED TE";
+ case U'\u1C86':
+ return "CYRILLIC SMALL LETTER TALL HARD SIGN";
+ case U'\u1C87':
+ return "CYRILLIC SMALL LETTER TALL YAT";
+ case U'\u1C88':
+ return "CYRILLIC SMALL LETTER UNBLENDED UK";
+ /* GENERAL PUNCTUATION: */
+ case U'\u2000':
+ return "EN QUAD";
+ case U'\u2001':
+ return "EM QUAD";
+ case U'\u2002':
+ return "EN SPACE";
+ case U'\u2003':
+ return "EM SPACE";
+ case U'\u2004':
+ return "THREE-PER-EM SPACE";
+ case U'\u2005':
+ return "FOUR-PER-EM SPACE";
+ case U'\u2006':
+ return "SIX-PER-EM SPACE";
+ case U'\u2007':
+ return "FIGURE SPACE";
+ case U'\u2008':
+ return "PUNCTUATION SPACE";
+ case U'\u2009':
+ return "THIN SPACE";
+ case U'\u200A':
+ return "HAIR SPACE";
+ case U'\u203C':
+ return "DOUBLE EXCLAMATION MARK";
+ case U'\u2047':
+ return "DOUBLE QUOTATION MARK";
+ case U'\u2048':
+ return "QUESTION EXCLAMATION MARK";
+ case U'\u2049':
+ return "EXCLAMATION QUESTION MARK";
+ /* CURRENCY SYMBOLS: */
+ case U'\u20A0':
+ return "EURO-CURRENCY SIGN";
+ case U'\u20A1':
+ return "COLON SIGN";
+ case U'\u20A2':
+ return "CR)EIRO SIGN";
+ case U'\u20A3':
+ return "FRENCH FRANC SIGN";
+ case U'\u20A4':
+ return "LIRA SIGN";
+ case U'\u20A5':
+ return "MILL SIGN";
+ case U'\u20A6':
+ return "NAIRA SIGN";
+ case U'\u20A7':
+ return "PESETA SIGN";
+ case U'\u20A8':
+ return "RUPEE SIGN";
+ case U'\u20A9':
+ return "WON SIGN";
+ case U'\u20AA':
+ return "::new SHEQEL SIGN";
+ case U'\u20AB':
+ return "DONG SIGN";
+ case U'\u20AC':
+ return "EURO SIGN";
+ case U'\u20AD':
+ return "KIP SIGN";
+ case U'\u20AE':
+ return "TUGRIK SIGN";
+ case U'\u20AF':
+ return "DRACHMA SIGN";
+ case U'\u20B0':
+ return "GERMAN PENNY SIGN";
+ case U'\u20B1':
+ return "PESO SIGN";
+ case U'\u20B2':
+ return "GUARANI SIGN";
+ case U'\u20B3':
+ return "AUSTRAL SIGN";
+ case U'\u20B4':
+ return "HRYVNIA SIGN";
+ case U'\u20B5':
+ return "CEDI SIGN";
+ case U'\u20B6':
+ return "LIVRE TOURNOIS SIGN";
+ case U'\u20B7':
+ return "SPESMILO SIGN";
+ case U'\u20B8':
+ return "TENGE SIGN";
+ case U'\u20BA':
+ return "TURKISH LIRA SIGN";
+ case U'\u20BB':
+ return "NORDIC MARK SIGN";
+ case U'\u20BC':
+ return "MANAT SIGN";
+ case U'\u20BD':
+ return "RUBLE SYMBOL";
+ case U'\u20BE':
+ return "LARI SIGN";
+ case U'\u20BF':
+ return "BITCOIN SIGN";
+ /* LETTERLIKE SYMBOLS: */
+ case U'\u2100':
+ return "ACCOUNT OF";
+ case U'\u2101':
+ return "ADRESSED TO THE SUBJECT";
+ case U'\u2102':
+ return "DOUBLE-STRUCK CAPITAL C";
+ case U'\u2103':
+ return "DEGREE CELSIUS";
+ case U'\u2104':
+ return "CENTRE LINE SYMBOL";
+ case U'\u2105':
+ return "CARE OF";
+ case U'\u2106':
+ return "CADA UNA";
+ case U'\u2107':
+ return "EULER CONSTANT";
+ case U'\u2108':
+ return "SCRUPLE";
+ case U'\u2109':
+ return "DEGREE FAHRENHEIT";
+ case U'\u210A':
+ return "SCRIPT SMALL G";
+ case U'\u210B':
+ return "SCRIPT CAPITAL H";
+ case U'\u210C':
+ return "BLACK-LETTER CAPITAL H";
+ case U'\u210D':
+ return "DOUBLE-STRUCK CAPITAL H";
+ case U'\u210E':
+ return "PLANCK CONSTANT";
+ case U'\u210F':
+ return "PLANCK CONSTANT OVER TWO PI";
+ case U'\u2110':
+ return "SCRIPT CAPITAL I";
+ case U'\u2111':
+ return "BLACK-LETTER CAPITAL I";
+ case U'\u2112':
+ return "SCRIPT CAPITAL L";
+ case U'\u2113':
+ return "SCRIPT SMALL L";
+ case U'\u2114':
+ return "L B BAR SYMBOL";
+ case U'\u2115':
+ return "DOUBLE-STRUCK CAPITAL N";
+ case U'\u2116':
+ return "NUMERO SIGN";
+ case U'\u2117':
+ return "SOUND RECORDING COPYRIGHT";
+ case U'\u2118':
+ return "SCRIPT CAPITAL P";
+ case U'\u2119':
+ return "DOUBLE-STRUCK CAPITAL P";
+ case U'\u211A':
+ return "DOUBLE-STRUCK CAPITAL Q";
+ case U'\u211B':
+ return "SCRIPT CAPITAL R";
+ case U'\u211C':
+ return "BLACK-LETTER CAPITAL R";
+ case U'\u211D':
+ return "DOUBLE-STRUCK CAPITAL R";
+ case U'\u211E':
+ return "PRESCRIPTION TAKE";
+ case U'\u211F':
+ return "RESPONSE";
+ case U'\u2120':
+ return "SERVICE MARK";
+ case U'\u2121':
+ return "TELEPHONE SIGN";
+ case U'\u2122':
+ return "TRADE MARK SIGN";
+ case U'\u2123':
+ return "VERSICLE";
+ case U'\u2124':
+ return "DOUBLE-STRUCK CAPITAL Z";
+ case U'\u2125':
+ return "OUNCE SIGN";
+ case U'\u2126':
+ return "OHM SIGN";
+ case U'\u2127':
+ return "INVERTED OHM SIGN";
+ case U'\u2128':
+ return "BLACK-LETTER CAPITAL Z";
+ case U'\u2129':
+ return "TURNED GREEK SMALL LETTER IOTA";
+ case U'\u212A':
+ return "KELVIN SIGN";
+ case U'\u212B':
+ return "ANGSTROM SIGN";
+ case U'\u212C':
+ return "SCRIPT CAPITAL B";
+ case U'\u212D':
+ return "BLACK-LETTER CAPITAL C";
+ case U'\u212E':
+ return "ESTIMATED SYMBOL";
+ case U'\u212F':
+ return "SCRIPT SMALL E";
+ case U'\u2130':
+ return "SCRIPT CAPITAL E";
+ case U'\u2131':
+ return "SCRIPT CAPITAL F";
+ case U'\u2132':
+ return "TURNED CAPITAL F";
+ case U'\u2133':
+ return "SCRIPT CAPITAL M";
+ case U'\u2134':
+ return "SCRIPT SMALL O";
+ case U'\u2135':
+ return "ALEF SYMBOL";
+ case U'\u2136':
+ return "BET SYMBOL";
+ case U'\u2137':
+ return "GIMEL SYMBOL";
+ case U'\u2138':
+ return "DALET SYMBOL";
+ case U'\u2139':
+ return "INFORMATION SOURCE";
+ case U'\u213A':
+ return "ROTATED CAPITAL Q";
+ case U'\u213B':
+ return "FACSIMILE SIGN";
+ case U'\u213C':
+ return "DOUBLE-STRUCK SMALL PI";
+ case U'\u213D':
+ return "DOUBLE-STRUCK SMALL GAMMA";
+ case U'\u213E':
+ return "DOUBLE-STRUCK CAPITAL GAMMA";
+ case U'\u213F':
+ return "DOUBLE-STRUCK CAPITAL PI";
+ case U'\u2140':
+ return "DOUBLE-STRUCK N-ARY SUMMATION";
+ case U'\u2141':
+ return "TURNED SANS-SERIF CAPITAL G";
+ case U'\u2142':
+ return "TURNED SANS-SERIF CAPITAL L";
+ case U'\u2143':
+ return "REVERSED SANS-SERIF CAPITAL L";
+ case U'\u2144':
+ return "TURNED SANS-SERIF CAPITAL Y";
+ case U'\u2145':
+ return "DOUBLE-STRUCK ITALIC CAPITAL D";
+ case U'\u2146':
+ return "DOUBLE-STRUCK ITALIC SMALL D";
+ case U'\u2147':
+ return "DOUBLE-STRUCK ITALIC SMALL E";
+ case U'\u2148':
+ return "DOUBLE-STRUCK ITALIC SMALL I";
+ case U'\u2149':
+ return "DOUBLE-STRUCK ITALIC SMALL J";
+ case U'\u214A':
+ return "PROPERTY LINE";
+ case U'\u214B':
+ return "TURNED AMPERSAND";
+ case U'\u214C':
+ return "PER SIGN";
+ case U'\u214D':
+ return "AKTIESELSKAB";
+ case U'\u214E':
+ return "TURNED SMALL F";
+ case U'\u214F':
+ return "SYMBOL FOR SAMARITAN SOURCE";
+ /* NUMBER FORMS: */
+ case U'\u2150':
+ return "VULGAR FRACTION ONE SEVENTH";
+ case U'\u2151':
+ return "VULGAR FRACTION ONE NINTH";
+ case U'\u2152':
+ return "VULGAR FRACTION ONE TENTH";
+ case U'\u2153':
+ return "VULGAR FRACTION ONE THIRD";
+ case U'\u2154':
+ return "VULGAR FRACTION TWO THIRDS";
+ case U'\u2155':
+ return "VULGAR FRACTION ONE FIFTH";
+ case U'\u2156':
+ return "VULGAR FRACTION TWO FIFTHS";
+ case U'\u2157':
+ return "VULGAR FRACTION THREE FIFTHS";
+ case U'\u2158':
+ return "VULGAR FRACTION FOUR FIFTHS";
+ case U'\u2159':
+ return "VULGAR FRACTION ONE SIXTH";
+ case U'\u215A':
+ return "VULGAR FRACTION FIVE SIXTHS";
+ case U'\u215B':
+ return "VULGAR FRACTION ONE EIGTH";
+ case U'\u215C':
+ return "VULGAR FRACTION THREE EIGTHS";
+ case U'\u215D':
+ return "VULGAR FRACTION FIVE EIGHTS";
+ case U'\u215E':
+ return "VULGAR FRACTION SEVEN EIGTHS";
+ case U'\u215F':
+ return "FRACTION NUMERATOR ONE";
+ case U'\u2160':
+ return "ROMAN NUMERAL ONE";
+ case U'\u2161':
+ return "ROMAN NUMERAL TWO";
+ case U'\u2162':
+ return "ROMAN NUMERAL THREE";
+ case U'\u2163':
+ return "ROMAN NUMERAL FOUR";
+ case U'\u2164':
+ return "ROMAN NUMERAL FIVE";
+ case U'\u2165':
+ return "ROMAN NUMERAL SIX";
+ case U'\u2166':
+ return "ROMAN NUMERAL SEVEN";
+ case U'\u2167':
+ return "ROMAN NUMERAL EIGHT";
+ case U'\u2168':
+ return "ROMAN NUMERAL NINE";
+ case U'\u2169':
+ return "ROMAN NUMERAL TEN";
+ case U'\u216A':
+ return "ROMAN NUMERAL ELEVEN";
+ case U'\u216B':
+ return "ROMAN NUMERAL TWELVE";
+ case U'\u216C':
+ return "ROMAN NUMERAL FIFTY";
+ case U'\u216D':
+ return "ROMAN NUMERAL ONE HUNDRED";
+ case U'\u216E':
+ return "ROMAN NUMERAL FIVE HUNDRED";
+ case U'\u216F':
+ return "ROMAN NUMERAL ONE THOUSAND";
+ case U'\u2170':
+ return "SMALL ROMAN NUMERAL ONE";
+ case U'\u2171':
+ return "SMALL ROMAN NUMERAL TWO";
+ case U'\u2172':
+ return "SMALL ROMAN NUMERAL THREE";
+ case U'\u2173':
+ return "SMALL ROMAN NUMERAL FOUR";
+ case U'\u2174':
+ return "SMALL ROMAN NUMERAL FIVE";
+ case U'\u2175':
+ return "SMALL ROMAN NUMERAL SIX";
+ case U'\u2176':
+ return "SMALL ROMAN NUMERAL SEVEN";
+ case U'\u2177':
+ return "SMALL ROMAN NUMERAL EIGHT";
+ case U'\u2178':
+ return "SMALL ROMAN NUMERAL NINE";
+ case U'\u2179':
+ return "SMALL ROMAN NUMERAL TEN";
+ case U'\u217A':
+ return "SMALL ROMAN NUMERAL ELEVEN";
+ case U'\u217B':
+ return "SMALL ROMAN NUMERAL TWELVE";
+ case U'\u217C':
+ return "SMALL ROMAN NUMERAL FIFTY";
+ case U'\u217D':
+ return "SMALL ROMAN NUMERAL ONE HUNDRED";
+ case U'\u217E':
+ return "SMALL ROMAN NUMERAL FIVE HUNDRED";
+ case U'\u217F':
+ return "SMALL ROMAN NUMERAL ONE THOUSAND";
+ case U'\u2180':
+ return "ROMAN NUMERAL ONE THOUSAND C D";
+ case U'\u2181':
+ return "ROMAN NUMERAL FIVE THOUSAND";
+ case U'\u2182':
+ return "ROMAN NUMERAL TEN THOUSAND";
+ case U'\u2183':
+ return "ROMAN NUMERAL REVERSED ONE HUNDRED";
+ case U'\u2184':
+ return "LATIN SMALL LETTER REVERSED C";
+ case U'\u2185':
+ return "ROMAN NUMERAL SIX LATE FORM";
+ case U'\u2186':
+ return "ROMAN NUMERAL FIFTY EARLY FORM";
+ case U'\u2187':
+ return "ROMAN NUMERAL FIFTY THOUSAND";
+ case U'\u2188':
+ return "ROMAN NUMERAL ONE HUNDRED THOUSAND";
+ case U'\u2189':
+ return "VULGAR FRACTION ZERO THIRDS";
+ case U'\u218A':
+ return "TURNED DIGIT TWO";
+ case U'\u218B':
+ return "TURNED DIGIT THREE";
+ /* MISCELLANEOUS SYMBOLS: */
+ case U'\u2630':
+ return "TRIGRAM FOR HEAVEN";
+ case U'\u2631':
+ return "TRIGRAM FOR LAKE";
+ case U'\u2632':
+ return "TRIGRAM FOR FIRE";
+ case U'\u2633':
+ return "TRIGRAM FOR THUNDER";
+ case U'\u2634':
+ return "TRIGRAM FOR WIND";
+ case U'\u2635':
+ return "TRIGRAM FOR WATER";
+ case U'\u2636':
+ return "TRIGRAM FOR MOUNTAIN";
+ case U'\u2637':
+ return "TRIGRAM FOR EARTH";
+ case U'\u2638':
+ return "WHEEL OF DHARMA";
+ case U'\u2639':
+ return "WHITE FROWNING FACE";
+ case U'\u263A':
+ return "WHITE SMILING FACE";
+ case U'\u263B':
+ return "BLACK SMILING FACE";
+ case U'\u263C':
+ return "WHITE SUN WITH RAYS";
+ case U'\u263D':
+ return "FIRST QUARTER MOON";
+ case U'\u263E':
+ return "LAST QUARTER MOON";
+ case U'\u263F':
+ return "MERCURY";
+ case U'\u2640':
+ return "FEMALE SIGN";
+ case U'\u2641':
+ return "EARTH";
+ case U'\u2642':
+ return "MALE SIGN";
+ case U'\u2643':
+ return "JUPITER";
+ case U'\u2644':
+ return "SATURN";
+ case U'\u2645':
+ return "URANUS";
+ case U'\u2646':
+ return "NEPTUNE";
+ case U'\u2647':
+ return "PLUTO";
+ case U'\u2648':
+ return "ARIES";
+ case U'\u2649':
+ return "TAURUS";
+ case U'\u264A':
+ return "GEMNINI";
+ case U'\u264B':
+ return "CANCER";
+ case U'\u264C':
+ return "LEO";
+ case U'\u264D':
+ return "VIRGO";
+ case U'\u264E':
+ return "LIBRA";
+ case U'\u264F':
+ return "SCORPIUS";
+ case U'\u2650':
+ return "SAGITTARIUS";
+ case U'\u2651':
+ return "CAPRICORN";
+ case U'\u2652':
+ return "AQUARIUS";
+ case U'\u2653':
+ return "PISCES";
+ case U'\u2654':
+ return "WHITE CHESS KING";
+ case U'\u2655':
+ return "WHITE CHESS QUEEN";
+ case U'\u2656':
+ return "WHITE CHESS ROOK";
+ case U'\u2657':
+ return "WHITE CHESS BISHOP";
+ case U'\u2658':
+ return "WHITE CHESS KNIGHT";
+ case U'\u2659':
+ return "WHITE CHESS PAWN";
+ case U'\u265A':
+ return "BLACK CHESS KING";
+ case U'\u265B':
+ return "BLACK CHESS QUEEN";
+ case U'\u265C':
+ return "BLACK CHESS ROOK";
+ case U'\u265D':
+ return "BLACK CHESS BISHOP";
+ case U'\u265E':
+ return "BLACK CHESS KNIGHT";
+ case U'\u265F':
+ return "BLACK CHESS PAWN";
+ case U'\u2660':
+ return "BLACK SPADE SUIT";
+ case U'\u2661':
+ return "WHITE HEART SUIT";
+ case U'\u2662':
+ return "WHITE DIAMOND SUIT";
+ case U'\u2663':
+ return "BLACK CLUB SUIT";
+ case U'\u2664':
+ return "WHITE SPADE SUIT";
+ case U'\u2665':
+ return "BLACK HEART SUIT";
+ case U'\u2666':
+ return "BLACK DIAMOND SUIT";
+ case U'\u2667':
+ return "WHITE CLUB SUIT";
+ case U'\u2668':
+ return "HOT SPRINGS";
+ case U'\u2669':
+ return "QUARTER NOTE";
+ case U'\u266A':
+ return "EIGHT NOTE";
+ case U'\u266B':
+ return "BEAMED EIGTH NOTES";
+ case U'\u266C':
+ return "BEAMED SIXTEENTH NOTES";
+ case U'\u266D':
+ return "MUSIC FLAT SIGN";
+ case U'\u266E':
+ return "MUSIC NEUTRAL SIGN";
+ case U'\u266F':
+ return "MUSIC SHARP SIGN";
+ case U'\u2670':
+ return "WEST SYRIAC CROSS";
+ case U'\u2671':
+ return "EAST SYRIAC CROSS";
+ case U'\u2672':
+ return "UNIVERSAL RECYCLING SYMBOL";
+ case U'\u2673':
+ return "RECYCLING SYMBOL FOR TYPE-1 PLASTICS";
+ case U'\u2674':
+ return "RECYCLING SYMBOL FOR TYPE-2 PLASTICS";
+ case U'\u2675':
+ return "RECYCLING SYMBOL FOR TYPE-3 PLASTICS";
+ case U'\u2676':
+ return "RECYCLING SYMBOL FOR TYPE-4 PLASTICS";
+ case U'\u2677':
+ return "RECYCLING SYMBOL FOR TYPE-5 PLASTICS";
+ case U'\u2678':
+ return "RECYCLING SYMBOL FOR TYPE-6 PLASTICS";
+ case U'\u2679':
+ return "RECYCLING SYMBOL FOR TYPE-7 PLASTICS";
+ case U'\u267A':
+ return "RECYCLING SYMBOL FOR GENERIC MATERIALS";
+ case U'\u267B':
+ return "BLACK UNIVERSAL RECYCLING SYMBOL";
+ case U'\u267C':
+ return "RECYCLED PAPER SYMBOL";
+ case U'\u267D':
+ return "PARTIALLY-RECYCLED PAPER SYMBOL";
+ case U'\u267E':
+ return "PERMANENT PAPER SIGN";
+ case U'\u267F':
+ return "WHEELCHAIR SYMBOL";
+ case U'\u26B9':
+ return "SEXTILE";
+ /* DINGBATS: */
+ case U'\u271D':
+ return "LATIN CROSS";
+ case U'\u2721':
+ return "STAR OF DAVID";
+ /* SUPPLEMENTAL PUNCTUATION: */
+ case U'\u2E3B':
+ return "THREE-EM DASH";
+ /* ARABIC PRESENTATION FORMS-A: */
+ case U'\uFDFD':
+ return "ARABIC LIGATURE BISMILLAH AL-RAHMAN AR-RAHEEM";
+ /* ANCIENT SYMBOLS: */
+ case U'\U00010190':
+ return "ROMAN SEXTANS SIGN";
+ case U'\U00010191':
+ return "ROMAN UNCIA SIGN";
+ case U'\U00010192':
+ return "ROMAN SEMUNCIA SIGN";
+ case U'\U00010193':
+ return "ROMAN SEXTULA SIGN";
+ case U'\U00010194':
+ return "ROMAN DIMIDIA SEXTULA SIGN";
+ case U'\U00010195':
+ return "ROMAN SILIQUA SIGN";
+ case U'\U00010196':
+ return "ROMAN DENARIUS SIGN";
+ case U'\U00010197':
+ return "ROMAN QUINARIUS SIGN";
+ case U'\U00010198':
+ return "ROMAN SESTERTIUS SIGN";
+ case U'\U00010199':
+ return "ROMAN DUPONDIUS SIGN";
+ case U'\U0001019A':
+ return "ROMAN AS SIGN";
+ case U'\U0001019B':
+ return "ROMAN CENTURIAL SIGN";
+ case U'\U0001019C':
+ return "ASCIA SIGN";
+ /* BRAHMI: */
+ case U'\U00011066':
+ return "BRAHMI DIGIT ZERO";
+ case U'\U00011067':
+ return "BRAHMI DIGIT ONE";
+ case U'\U00011068':
+ return "BRAHMI DIGIT TWO";
+ case U'\U00011069':
+ return "BRAHMI DIGIT THREE";
+ case U'\U0001106A':
+ return "BRAHMI DIGIT FOUR";
+ case U'\U0001106B':
+ return "BRAHMI DIGIT FIVE";
+ case U'\U0001106C':
+ return "BRAHMI DIGIT SIX";
+ case U'\U0001106D':
+ return "BRAHMI DIGIT SEVEN";
+ case U'\U0001106E':
+ return "BRAHMI DIGIT EIGHT";
+ case U'\U0001106F':
+ return "BRAHMI DIGIT NINE";
+ /* CUNEIFORM: */
+ case U'\U00012031':
+ return "CUNEIFORM SIGN AN PLUS NAGA SQUARED";
+ /* CUNEIFORM NUMBERS AND PUNCTUATION: */
+ case U'\U0001242B':
+ return "CUNEIFORM NUMERIC SIGN NINE SHAR2";
+ /* EGYPTIAN HIEROGLYPHS: */
+ case U'\U000130B8':
+ return "EGYPTIAN HIEROGLYPH D052";
+ /* COUNTING ROD NUMERALS: */
+ case U'\U0001D372':
+ return "IDEOGRAPHIC TALLY MARK ONE";
+ case U'\U0001D373':
+ return "IDEOGRAPHIC TALLY MARK TWO";
+ case U'\U0001D374':
+ return "IDEOGRAPHIC TALLY MARK THREE";
+ case U'\U0001D375':
+ return "IDEOGRAPHIC TALLY MARK FOUR";
+ case U'\U0001D376':
+ return "IDEOGRAPHIC TALLY MARK FIVE";
+ case U'\U0001D377':
+ return "TALLY MARK ONE";
+ case U'\U0001D378':
+ return "TALLY MARK FIVE";
+ /* ENCLOSED ALPHANUMERIC SUPPLEMENT: */
+ case U'\U0001F10D':
+ return "CIRCLED ZERO WITH SLASH";
+ case U'\U0001F10E':
+ return "CIRCLED ANTICKLOCKWISE ARROW";
+ case U'\U0001F10F':
+ return "CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH";
+ case U'\U0001F12F':
+ return "COPYLEFT SYMBOL";
+ case U'\U0001F16D':
+ return "CIRCLED CC";
+ case U'\U0001F16E':
+ return "CIRCLED C WITH OVERLAID BACKSLASH";
+ case U'\U0001F16F':
+ return "CIRCLED HUMAN FIGURE";
+ /* EMOTICONS: */
+ case U'\U0001F600':
+ return "GRINNING FACE";
+ case U'\U0001F601':
+ return "GRINNING FACE WITH SMIRKING EYES";
+ case U'\U0001F602':
+ return "FACE WITH TEARS OF JOY";
+ case U'\U0001F603':
+ return "SMILING FACE WITH OPEN MOUTH";
+ case U'\U0001F604':
+ return "SMILING FACE WITH OPEN MOUTH AND SMILING EYES";
+ case U'\U0001F605':
+ return "SMILING FACE WITH OPEN MOUTH AND COULD SWEAT";
+ case U'\U0001F606':
+ return "SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES";
+ case U'\U0001F607':
+ return "SMILING FACE WITH HALO";
+ case U'\U0001F608':
+ return "SMILING FACE WITH HORNS";
+ case U'\U0001F609':
+ return "WINKING FACE";
+ case U'\U0001F60A':
+ return "SMILING FACE WITH SMILING EYES";
+ case U'\U0001F60B':
+ return "FACE SAVOURING DELICIOUS FOOD";
+ case U'\U0001F60C':
+ return "RELIEVED FACE";
+ case U'\U0001F60D':
+ return "SMILLING FACE HEART-SHAPED EYES";
+ case U'\U0001F60E':
+ return "SMILLING FACE WITH SUNGLASSES";
+ case U'\U0001F60F':
+ return "SMIRKING FACE";
+ case U'\U0001F610':
+ return "NEUTRAL FACE";
+ case U'\U0001F611':
+ return "EXPRESSIONLESS FACE";
+ case U'\U0001F612':
+ return "UNAMUSED FACE";
+ case U'\U0001F613':
+ return "FACE WITH COLD SWEAT";
+ case U'\U0001F614':
+ return "PENSIVE FACE";
+ case U'\U0001F615':
+ return "CONFUSED FACE";
+ case U'\U0001F616':
+ return "CONFOUNDED FACE";
+ case U'\U0001F617':
+ return "KISSING FACE";
+ case U'\U0001F618':
+ return "FACE THROWING A KISS";
+ case U'\U0001F619':
+ return "KISSING FACE WITH SMILLING EYES";
+ case U'\U0001F61A':
+ return "KISSING FACE WITH CLOSED EYES";
+ case U'\U0001F61B':
+ return "FACE WITH STUCK-OUT TONGUE";
+ case U'\U0001F61C':
+ return "FACE WITH STUCK-OUT TONGUE AND WINKING EYE";
+ case U'\U0001F61D':
+ return "FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES";
+ case U'\U0001F61E':
+ return "DISSAPOINTED FACE";
+ case U'\U0001F61F':
+ return "WORRIED FACE";
+ case U'\U0001F620':
+ return "ANGRY FACE";
+ case U'\U0001F621':
+ return "POUTING FACE";
+ case U'\U0001F622':
+ return "CRYING FACE";
+ case U'\U0001F623':
+ return "PERSEVERING FACE";
+ case U'\U0001F624':
+ return "FACE WITH LOOK OF TRIUMPH";
+ case U'\U0001F625':
+ return "DISSAPOINTED BUT RELIEVED FACE";
+ case U'\U0001F626':
+ return "FROWNING FACE WITH OPEN MOUTH";
+ case U'\U0001F627':
+ return "ANGUISHED FACE";
+ case U'\U0001F628':
+ return "FEARFUL FACE";
+ case U'\U0001F629':
+ return "WEARY FACE";
+ case U'\U0001F62A':
+ return "SLEEPY FACE";
+ case U'\U0001F62B':
+ return "TIRED FACE";
+ case U'\U0001F62C':
+ return "GRIMACING FACE";
+ case U'\U0001F62D':
+ return "LOUDLY CRYING FACE";
+ case U'\U0001F62E':
+ return "FACE WITH OPEN MOUTH";
+ case U'\U0001F62F':
+ return "HUSHED FACE";
+ case U'\U0001F630':
+ return "FACE WITH OPEN MOUTH AND COLD SWEAT";
+ case U'\U0001F631':
+ return "FACE SCREAMING IN FEAR";
+ case U'\U0001F632':
+ return "ASTONISHED FACE";
+ case U'\U0001F633':
+ return "FLUSHED FACE";
+ case U'\U0001F634':
+ return "SLEEPING FACE";
+ case U'\U0001F635':
+ return "DIZZY FACE";
+ case U'\U0001F636':
+ return "FACE WITHOUT MOUTH";
+ case U'\U0001F637':
+ return "FACE WITH MEDICAL MASK";
+ case U'\U0001F641':
+ return "SLIGHTLY FROWNING FACE";
+ case U'\U0001F642':
+ return "SLIGHTLY SMILING FACE";
+ case U'\U0001F643':
+ return "UPSIDE-DOWN FACE";
+ case U'\U0001F644':
+ return "FACE WITH ROLLING EYES";
+ /* ORNAMENTAL DINGBATS: */
+ case U'\U0001F670':
+ return "SCRIPT LIGATURE ET ORNAMENT";
+ case U'\U0001F671':
+ return "HEAVY SCRIPT LIGATURE ET ORNAMENT";
+ case U'\U0001F672':
+ return "LIGATURE OPEN ET ORNAMENT";
+ case U'\U0001F673':
+ return "HEAVY LIGATURE OPEN ET ORNAMENT";
+ case U'\U0001F674':
+ return "HEAVY AMPERSAND ORNAMENT";
+ case U'\U0001F675':
+ return "SWASH AMPERSAND ORNAMENT";
+ case U'\U0001F676':
+ return "SANS-SERIF HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT";
+ case U'\U0001F677':
+ return "SANS-SERIF HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT";
+ case U'\U0001F678':
+ return "SANS-SERIF HEAVY LOW DOUBLE QUOTATION MARK ORNAMENT";
+ case U'\U0001F679':
+ return "HEAVY INTERROBANG ORNAMENT";
+ case U'\U0001F67A':
+ return "SANS-SERIF INTERROBANG ORNAMENT";
+ case U'\U0001F67B':
+ return "HEAVY SANS-SERIF INTERROBANG ORNAMENT";
+ case U'\U0001F67C':
+ return "VERY HEAVY SOLIDUS";
+ case U'\U0001F67D':
+ return "VERY HEAVY REVERSE SOLIDUS";
+ case U'\U0001F67E':
+ return "CHECKER BOARD";
+ case U'\U0001F67F':
+ return "REVERSE CHECKER BOARD";
+ /* CJK UNIFIED IDEOGRAPHS EXTENSION G: */
+ case U'\U0003106C':
+ return "CJK UNIFIED IDEOGRAPH-3106C";
+ /* TAGS: */
+ case U'\U000E0001':
+ return "LANGUAGE TAG";
+ case U'\U000E0020':
+ return "TAG SPACE";
+ case U'\U000E0021':
+ return "TAG EXCLAMATION MARK";
+ case U'\U000E0022':
+ return "TAG QUOTATION MARK";
+ case U'\U000E0023':
+ return "TAG NUMBER SIGN";
+ case U'\U000E0024':
+ return "TAG DOLLAR SIGN";
+ case U'\U000E0025':
+ return "TAG PERCENT SIGN";
+ case U'\U000E0026':
+ return "TAG AMPERSAND";
+ case U'\U000E0027':
+ return "TAG APOSTROPHE";
+ case U'\U000E0028':
+ return "TAG LEFT PARANTHESIS";
+ case U'\U000E0029':
+ return "TAG RIGHT PARANTHESIS";
+ case U'\U000E002A':
+ return "TAG ASTERISK";
+ case U'\U000E002B':
+ return "TAG PLUS SIGN";
+ case U'\U000E002C':
+ return "TAG COMMA";
+ case U'\U000E002D':
+ return "TAG HYPHEN-MINUS";
+ case U'\U000E002E':
+ return "TAG FULL STOP";
+ case U'\U000E002F':
+ return "TAG SOLIDUS";
+ case U'\U000E0030':
+ return "TAG DIGIT ZERO";
+ case U'\U000E0031':
+ return "TAG DIGIT ONE";
+ case U'\U000E0032':
+ return "TAG DIGIT TWO";
+ case U'\U000E0033':
+ return "TAG DIGIT THREE";
+ case U'\U000E0034':
+ return "TAG DIGIT FOUR";
+ case U'\U000E0035':
+ return "TAG DIGIT FIVE";
+ case U'\U000E0036':
+ return "TAG DIGIT SIX";
+ case U'\U000E0037':
+ return "TAG DIGIT SEVEN";
+ case U'\U000E0038':
+ return "TAG DIGIT EIGHT";
+ case U'\U000E0039':
+ return "TAG DIGIT NINE";
+ case U'\U000E003A':
+ return "TAG COLON";
+ case U'\U000E003B':
+ return "TAG SEMICOLON";
+ case U'\U000E003C':
+ return "TAG LESS-THAN SIGN";
+ case U'\U000E003D':
+ return "TAG EQUALS SIGN";
+ case U'\U000E003E':
+ return "TAG GREATER-THAN SIGN";
+ case U'\U000E003F':
+ return "TAG QUESTION MARK";
+ case U'\U000E0040':
+ return "TAG COMMERCIAL AT";
+ case U'\U000E0041':
+ return "TAG LATIN CAPITAL LETTER A";
+ case U'\U000E0042':
+ return "TAG LATIN CAPITAL LETTER B";
+ case U'\U000E0043':
+ return "TAG LATIN CAPITAL LETTER C";
+ case U'\U000E0044':
+ return "TAG LATIN CAPITAL LETTER D";
+ case U'\U000E0045':
+ return "TAG LATIN CAPITAL LETTER E";
+ case U'\U000E0046':
+ return "TAG LATIN CAPITAL LETTER F";
+ case U'\U000E0047':
+ return "TAG LATIN CAPITAL LETTER G";
+ case U'\U000E0048':
+ return "TAG LATIN CAPITAL LETTER H";
+ case U'\U000E0049':
+ return "TAG LATIN CAPITAL LETTER I";
+ case U'\U000E004A':
+ return "TAG LATIN CAPITAL LETTER J";
+ case U'\U000E004B':
+ return "TAG LATIN CAPITAL LETTER K";
+ case U'\U000E004C':
+ return "TAG LATIN CAPITAL LETTER L";
+ case U'\U000E004D':
+ return "TAG LATIN CAPITAL LETTER M";
+ case U'\U000E004E':
+ return "TAG LATIN CAPITAL LETTER N";
+ case U'\U000E004F':
+ return "TAG LATIN CAPITAL LETTER O";
+ case U'\U000E0050':
+ return "TAG LATIN CAPITAL LETTER P";
+ case U'\U000E0051':
+ return "TAG LATIN CAPITAL LETTER Q";
+ case U'\U000E0052':
+ return "TAG LATIN CAPITAL LETTER R";
+ case U'\U000E0053':
+ return "TAG LATIN CAPITAL LETTER S";
+ case U'\U000E0054':
+ return "TAG LATIN CAPITAL LETTER T";
+ case U'\U000E0055':
+ return "TAG LATIN CAPITAL LETTER ";
+ case U'\U000E0056':
+ return "TAG LATIN CAPITAL LETTER V";
+ case U'\U000E0057':
+ return "TAG LATIN CAPITAL LETTER W";
+ case U'\U000E0058':
+ return "TAG LATIN CAPITAL LETTER X";
+ case U'\U000E0059':
+ return "TAG LATIN CAPITAL LETTER Y";
+ case U'\U000E005A':
+ return "TAG LATIN CAPITAL LETTER Z";
+ case U'\U000E005B':
+ return "TAG LEFT SQUARE BRACKET";
+ case U'\U000E005C':
+ return "TAG REVERSE SOLIDUS";
+ case U'\U000E005D':
+ return "TAG RIGHT SQUARE BRACKET";
+ case U'\U000E005E':
+ return "TAG CIRCUMFLEX ACCENT";
+ case U'\U000E005F':
+ return "TAG LOW LINE";
+ case U'\U000E0060':
+ return "TAG GRAVE ACCENT";
+ case U'\U000E0061':
+ return "TAG LATIN SMALL LETTER A";
+ case U'\U000E0062':
+ return "TAG LATIN SMALL LETTER B";
+ case U'\U000E0063':
+ return "TAG LATIN SMALL LETTER C";
+ case U'\U000E0064':
+ return "TAG LATIN SMALL LETTER D";
+ case U'\U000E0065':
+ return "TAG LATIN SMALL LETTER E";
+ case U'\U000E0066':
+ return "TAG LATIN SMALL LETTER F";
+ case U'\U000E0067':
+ return "TAG LATIN SMALL LETTER G";
+ case U'\U000E0068':
+ return "TAG LATIN SMALL LETTER H";
+ case U'\U000E0069':
+ return "TAG LATIN SMALL LETTER I";
+ case U'\U000E006A':
+ return "TAG LATIN SMALL LETTER J";
+ case U'\U000E006B':
+ return "TAG LATIN SMALL LETTER K";
+ case U'\U000E006C':
+ return "TAG LATIN SMALL LETTER L";
+ case U'\U000E006D':
+ return "TAG LATIN SMALL LETTER M";
+ case U'\U000E006E':
+ return "TAG LATIN SMALL LETTER N";
+ case U'\U000E006F':
+ return "TAG LATIN SMALL LETTER O";
+ case U'\U000E0070':
+ return "TAG LATIN SMALL LETTER P";
+ case U'\U000E0071':
+ return "TAG LATIN SMALL LETTER Q";
+ case U'\U000E0072':
+ return "TAG LATIN SMALL LETTER R";
+ case U'\U000E0073':
+ return "TAG LATIN SMALL LETTER S";
+ case U'\U000E0074':
+ return "TAG LATIN SMALL LETTER T";
+ case U'\U000E0075':
+ return "TAG LATIN SMALL LETTER ";
+ case U'\U000E0076':
+ return "TAG LATIN SMALL LETTER V";
+ case U'\U000E0077':
+ return "TAG LATIN SMALL LETTER W";
+ case U'\U000E0078':
+ return "TAG LATIN SMALL LETTER X";
+ case U'\U000E0079':
+ return "TAG LATIN SMALL LETTER Y";
+ case U'\U000E007A':
+ return "TAG LATIN SMALL LETTER Z";
+ case U'\U000E007B':
+ return "TAG LEFT CURLY BRACKET";
+ case U'\U000E007C':
+ return "TAG VERTICAL LINE";
+ case U'\U000E007D':
+ return "TAG RIGHT CURLY BRACKET";
+ case U'\U000E007E':
+ return "TAG TILDE";
+ case U'\U000E007F':
+ return "CANCEL TAG";
+ }
+}
diff --git a/dux/include/dux/str.h b/dux/include/dux/str.h
new file mode 100644
index 0000000..86f5c17
--- /dev/null
+++ b/dux/include/dux/str.h
@@ -0,0 +1,18 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
diff --git a/dux/include/dux/sysinfo.h b/dux/include/dux/sysinfo.h
new file mode 100644
index 0000000..eb0840b
--- /dev/null
+++ b/dux/include/dux/sysinfo.h
@@ -0,0 +1,388 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# if !defined(dux_hdr_sysinfo)
+# define dux_hdr_sysinfo
+
+/*
+ It is a requirement for all headers to be includable from every edition of ISO C.
+ It is, however, not a requirement for them to declare - let alone define - anything in all versions.
+
+ This header may only define macros, who themselves must be compatible with an C89 preprocessor (so variadic function-like macros are not allowed).
+
+ The minimum required version of C++ for all identifieres in all headers to be available is C++20. For C, it is C11.
+*/
+# if defined(__STDC__) && !defined(__cplusplus) /* C++ compilers may define the macros (__STDC__) and (__STDC_VERSION__). */
+# define dux_lang_c
+# if defined(__STDC_VERSION__)
+# if __STDC_VERSION__ > 0x313EE
+# define dux_lang_c90
+# define dux_lang_c95
+# define dux_lang_c99
+# define dux_lang_c11
+# define dux_lang_c17
+# define dux_lang_c23
+# elif __STDC_VERSION__ > 0x31198
+# define dux_lang_c90
+# define dux_lang_c95
+# define dux_lang_c99
+# define dux_lang_c11
+# define dux_lang_c17
+# elif __STDC_VERSION__ > 0x30CDD
+# define dux_lang_c90
+# define dux_lang_c95
+# define dux_lang_c99
+# define dux_lang_c11
+# elif __STDC_VERSION__ > 0x30AF1
+# define dux_lang_c90
+# define dux_lang_c95
+# define dux_lang_c99
+# else
+# define dux_lang_c90
+# define dux_lang_c95
+# endif
+# else
+# define dux_lang_c90
+# endif
+# elif defined(__cplusplus)
+# define dux_lang_cxx
+# if __cplusplus > 0x31512
+# define dux_lang_cxx98
+# define dux_lang_cxx11
+# define dux_lang_cxx14
+# define dux_lang_cxx17
+# define dux_lang_cxx20
+# define dux_lang_cxx23
+# elif __cplusplus > 0x313E7
+# define dux_lang_cxx98
+# define dux_lang_cxx11
+# define dux_lang_cxx14
+# define dux_lang_cxx17
+# define dux_lang_cxx20
+# elif __cplusplus > 0x312BA
+# define dux_lang_cxx98
+# define dux_lang_cxx11
+# define dux_lang_cxx14
+# define dux_lang_cxx17
+# elif __cplusplus > 0x3118F
+# define dux_lang_cxx98
+# define dux_lang_cxx11
+# define dux_lang_cxx14
+# elif __cplusplus > 0x30C1F
+# define dux_lang_cxx98
+# define dux_lang_cxx11
+# else
+# define dux_lang_cxx98
+# endif
+# endif
+
+/*
+ Compiler detection:
+ Please refer to the compiler in question for a list of predefined macros it defines.
+*/
+# if defined(__clang__)
+# define dux_cmpl_clang
+# endif
+# if defined(__xlC__)
+# define dux_cmpl_ibmxl
+# endif
+# if defined(__INTEL_COMPILER)
+# define dux_cmpl_icc
+# endif
+# if defined(_MSC_VER)
+# define dux_cmpl_msvc
+# endif
+# if defined(__TINYC__)
+# define dux_cmpl_tcc
+# endif
+# if defined(__PCC__)
+# define dux_cmpl_pcc
+# endif
+# if defined(__GNUC__) || defined(__GNUG__) && (!defined(dux_cmpl_clang) && !defined(dux_cmpl_icc) && !defined(dux_cmpl_pcc))
+# define dux_cmpl_gcc
+# endif
+
+/* Arch detection: only test for macros that ARE defined by our supported compilers (those we have an identification macro for). */
+# if defined(__alpha__) || defined(_M_ALPHA)
+# define dux_arch_alpha
+# endif
+# if defined(__aarch64__) || defined(__arm__) || defined(__thumb__) || defined(_M_ARM) || defined(_M_ARMT)
+# define dux_arch_arm
+# endif
+# if defined(__mips) || defined(__mips__)
+# define dux_arch_mips
+# endif
+# if defined(__PPC64__) || defined(__POWERPC) || defined(__PPC__) || defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_PPC) || defined(_M_PPC64)
+# define dux_arch_ppc
+# endif
+# if defined(__riscv)
+# define dux_arch_riscv
+# endif
+# if defined(__sparc__)
+# define dux_arch_sparc
+# endif
+# if defined(__THW_INTEL__) || defined(__amd64) || defined(__amd64__) || defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_I86) || defined(_M_IX86)
+# define dux_arch_x86
+# endif
+
+# if !defined(dux_bytesz) /* We will give the user the ability to define the size of bytes in case we can't figure it out. */
+# if defined(dux_arch_arm) || defined(dux_arch_mips) || defined(dux_arch_ppc) || defined(dux_arch_riscv) || defined(dux_arch_sparc) || defined(dux_arch_x86) || defined(dux_os_posix) || defined(dux_os_win) /* These architectures use 8 bits per byte. POSIX requires the size of bytes (in bits) to be exactly 8. Windows also uses 8 bits per byte. */
+# define dux_bytesz 0x8
+# elif defined(__CHAR_BIT__)
+# define dux_bytesz __CHAR_BIT__
+# else
+# error Unable to get the size of bytes in bits! Define (dux_bytesz) to remove this message!
+# endif
+# endif
+
+# if defined(__ILP32__) || defined(_ILP32) || (defined(_WIN32) && !defined(_WIN64))
+# define dux_priv_datmodl_ilp32
+# elif defined(_WIN64)
+# define dux_priv_datmodl_llp64
+# elif defined(__LP64__) || defined(_LP64)
+# define dux_priv_datmodl_lp64
+# endif
+
+# if !defined(dux_wrdsz)
+/* For detecting word size, we will check for helpers in the following order: Data model, machine arcitechture, compiler, operating system */
+# if defined(dux_priv_datmodl_ilp32) || defined(dux_priv_datmodl_lp32)
+# define dux_wrdsz 0x20
+# elif defined(dux_priv_datmodl_ilp64) || defined(dux_priv_datmodl_llp64) || defined(dux_priv_datmodl_lp64) || defined(dux_priv_datmodl_silp64)
+# define dux_wrdsz 0x40
+# elif defined(__PPC64__) || defined(__aarch64__) || defined(__amd64) || defined(__amd64__) || defined(__powerpc64__) || defined(__ppc64__) || defined(__x86_64) || defined(__x86_64__) || defined(_ARCH_PPC64) || defined(_M_AMD64) || defined(_M_PPC64)
+# define dux_wrdsz 0x40
+# elif defined(__riscv_xlen)
+# define dux_wrdsz __riscv_xlen
+# elif defined(dux_cmpl_clang) || defined(dux_cmpl_gcc)
+# define dux_wrdsz __SIZE_WIDTH__
+# elif defined(_WIN16)
+# define dux_wrdsz 0x10
+# elif defined(_WIN32)
+# define dux_wrdsz 0x20
+# elif defined(_WIN64)
+# define dux_wrdsz 0x40
+# else
+# error Unable to get the size of words! Define (dux_wrdsz) to remove this error!
+# endif
+# endif
+
+# if defined(__CHAR_UNSIGNED__) || (defined(dux_cmpl_icc) && !defined(__SIGNED_CHARS__)) || (defined(dux_cmpl_msvc) && defined(_CHAR_UNSIGNED))
+# define dux_uchr true
+# else
+# define dux_uchr false
+# endif
+
+# if defined(__DBL_MAX__) && defined(__FLT_MAX__) && defined(__LDBL_MAX__) && defined(__WCHAR_MAX__)
+# define dux_dblmax __DBL_MAX__
+# define dux_fltmax __FLT_MAX__
+# define dux_ldblmax __LDBL_MAX__
+# define dux_wchrmax __WCHAR_MAX__
+# endif
+# if defined(dux_priv_datmodl_ilp32)
+# define dux_intmax 0x7FFFFFFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFF
+# elif defined(dux_priv_datmodl_lp32)
+# define dux_intmax 0x7FFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFF
+# elif defined(dux_priv_datmodl_ilp64)
+# define dux_intmax 0x7FFFFFFFFFFFFFFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFFFFFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFF
+# elif defined(dux_priv_datmodl_llp64)
+# define dux_intmax 0x7FFFFFFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFF
+# elif defined(dux_priv_datmodl_lp64)
+# define dux_intmax 0x7FFFFFFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFFFFFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFF
+# elif defined(dux_priv_datmodl_silp64)
+# define dux_intmax 0x7FFFFFFFFFFFFFFF
+# define dux_llngmax 0x7FFFFFFFFFFFFFFF
+# define dux_lngmax 0x7FFFFFFFFFFFFFFF
+# define dux_schrmax 0x7F
+# define dux_shrtmax 0x7FFFFFFFFFFFFFFF
+# elif defined(__INT_MAX__) && defined(__LONG_LONG_MAX__) && defined(__LONG_MAX__) && defined(__SCHAR_MAX__) && defined(__SHRT_MAX__)
+# define dux_intmax __INT_MAX__
+# define dux_llngmax __LONG_LONG_MAX__
+# define dux_lngmax __LONG_MAX__
+# define dux_schrmax __SCHAR_MAX__
+# define dux_shrtmax __SHRT_MAX__
+# endif
+# define dux_chr16max 0xFFFF
+# define dux_chr32max 0xFFFFFFFF
+# define dux_chr8max 0xFF
+# define dux_uchrmax (dux_schrmax * 0x2u + 0x1u)
+# define dux_uintmax (dux_intmax * 0x2u + 0x1u)
+# define dux_ullngmax (dux_llngmax * 0x2ull + 0x1ull)
+# define dux_ulngmax (dux_lngmax * 0x2ul + 0x1ul)
+# define dux_ushrtmax (dux_shrtmax * 0x2u + 0x1u)
+# if dux_uchr
+# define dux_chrmax dux_uchrmax
+# else
+# define dux_chrmax dux_schrmax
+# endif
+
+/* Operating system detection: we will only support "modern" operating systems (those, that are still supported). */
+# if defined(__TOS_AIX__) || defined(_AIX)
+# define dux_os_aix
+# define dux_osstr "aix"
+# endif
+# if defined(__amigaos__)
+# define dux_os_amiga
+# define dux_osstr "amiga"
+# endif
+# if defined(__ANDROID__)
+# define dux_os_android
+# define dux_osstr "android"
+# endif
+# if defined(__OS2__) || defined(__TOS_OS2__) || defined(_OS2) /* I assume ArcaOS has the same predefined macros as OS/2. */
+# define dux_os_arca
+# define dux_osstr "arca"
+# endif
+# if defined(__THW_BLUEGENE__) || defined(__TOS_BGQ__) || defined(__bg__) || defined(__bgq__)
+# define dux_os_bluegene
+# define dux_osstr "bluegene"
+# endif
+# if defined(__APPLE__) || defined(__MACH__)
+# define dux_os_darwin
+# define dux_osstr "darwin"
+# endif
+# if defined(__DragonFly__)
+# define dux_os_dragonflybsd
+# define dux_osstr "dragonflybsd"
+# endif
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# define dux_os_freebsd
+# define dux_osstr "freebsd"
+# endif
+# if defined(__BEOS__)
+# define dux_os_haiku
+# define dux_osstr "haiku"
+# endif
+# if defined(__hpux) || defined(_hpux)
+# define dux_os_hpux
+# define dux_osstr "hpux"
+# endif
+# if defined(__GNU__) || defined(__gnu_hurd__)
+# define dux_os_hurd
+# define dux_osstr "hurd"
+# endif
+# if defined(__OS400__) || defined(__OS400_TGTVRM__)
+# define dux_os_ibmi
+# define dux_osstr "ibmi"
+# endif
+# if defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS)
+# define dux_os_msdos
+# define dux_osstr "msdos"
+# endif
+# if defined(__NetBSD__)
+# define dux_os_netbsd
+# define dux_osstr "netbsd"
+# endif
+# if defined(__OpenBSD__)
+# define dux_os_openbsd
+# define dux_osstr "openbsd"
+# endif
+# if defined(__sun)
+# define dux_os_solaris
+# define dux_osstr "solaris"
+# endif
+# if defined(__VMS) || defined(__vms)
+# define dux_os_openvms
+# define dux_osstr "openvms"
+# endif
+# if defined(__TOS_WIN__) || defined(__WIN32__) || defined(__WINDOWS__) || defined(_WIN16) || defined(_WIN32) || defined(_WIN32_CE) || defined(_WIN64)
+# define dux_os_win
+# define dux_osstr "win"
+# endif
+# if defined(_SYSTYPE_BSD) || defined(dux_os_dragonflybsd) || defined(dux_os_freebsd) || defined(dux_os_netbsd) || defined(dux_os_openbsd)
+# define dux_os_bsd
+# if !defined(dux_osstr)
+# define dux_osstr "bsd-misc"
+# endif
+# endif
+# if defined(__linux) || defined(__linux__) || defined(dux_os_android)
+# define dux_os_linux
+# define dux_osstr "linux"
+# endif
+# if defined(__unix) || defined(__unix__) || defined(dux_os_aix) || defined(dux_os_android)|| defined(dux_os_bsd) || defined(dux_os_hpux) || defined(dux_os_hurd) || defined(dux_os_linux) || defined(dux_os_darwin) || defined(dux_os_solaris)
+# define dux_os_posix
+# if !defined(dux_osstr)
+# define dux_osstr "posix-misc"
+# endif
+# endif
+# if !defined(dux_osstr)
+# define dux_osstr "unknown"
+# endif
+
+# if defined(dux_os_win)
+# define dux_priv_abi_win
+# elif defined(dux_os_posix)
+# define dux_priv_abi_sysv
+# endif
+
+# if defined(dux_priv_abi_sysv)
+# define dux_priv_abistr "sysv"
+# elif defined(dux_priv_abi_win)
+# define dux_priv_abistr "win"
+# else
+# endif
+
+# if defined(dux_arch_arm)
+# if dux_wrdsz == 0x40
+# define dux_archstr "aarch64"
+# else
+# define dux_archstr "arm"
+# endif
+# elif defined(dux_arch_mips)
+# define dux_archstr "mips"
+# elif defined(dux_arch_ppc)
+# if dux_wrdsz == 0x40
+# define dux_archstr "powerpc64"
+# else
+# define dux_archstr "powerpc"
+# endif
+# elif defined(dux_arch_risv)
+# define dux_archstr "riscv"
+# elif defined(dux_arch_sparc)
+# define dux_archstr "sparc"
+# elif defined(dux_arch_x86)
+# if dux_wrdsz == 0x40
+# define dux_archstr "amd64"
+# else
+# define dux_archstr "x86"
+# endif
+# else
+# define dux_archstr "unknown"
+# endif
+
+# endif
diff --git a/include/dux/thrd b/dux/include/dux/thrd
index cc443d7..52436c4 100644
--- a/include/dux/thrd
+++ b/dux/include/dux/thrd
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,14 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_thrd)
-#define dux_hdr_thrd
+# pragma once
-#include <dux/sys>
-#include <dux/thrd.hh>
+# include <dux/base>
-#endif
+# include <dux/thrd.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/thrd.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/thrd.hh>
+# endif
diff --git a/dux/include/dux/thrd.h b/dux/include/dux/thrd.h
new file mode 100644
index 0000000..86f5c17
--- /dev/null
+++ b/dux/include/dux/thrd.h
@@ -0,0 +1,18 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
diff --git a/dux/include/dux/time b/dux/include/dux/time
new file mode 100644
index 0000000..dabb7a3
--- /dev/null
+++ b/dux/include/dux/time
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# pragma once
+
+# include <dux/base>
+
+# include <dux/time.h>
+
+# if defined(dux_lang_c)
+# include <dux/c/time.h>
+# elif defined(dux_lang_cxx)
+# include <dux/cxx/time.hh>
+# endif
diff --git a/dux/include/dux/time.h b/dux/include/dux/time.h
new file mode 100644
index 0000000..209d213
--- /dev/null
+++ b/dux/include/dux/time.h
@@ -0,0 +1,32 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# if defined(dux_lang_c)
+
+dux_attr_useret dux_sint64 dux_gettime(void);
+ void dux_sleep( dux_uint64 sec);
+
+# elif defined(dux_lang_cxx)
+
+namespace dux {
+ [[nodiscard]] auto gettime() noexcept -> ::dux::sint64;
+ auto sleep( ::dux::uint64 sec) noexcept -> void;
+}
+
+# endif
diff --git a/dux/src/abrt.cc b/dux/src/abrt.cc
new file mode 100644
index 0000000..36a9b4b
--- /dev/null
+++ b/dux/src/abrt.cc
@@ -0,0 +1,38 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <atomic>
+# include <dux/sig>
+# include <dux/thrd>
+
+auto ::dux::abrt() noexcept -> void {
+ static ::std::atomic_flag lock {ATOMIC_FLAG_INIT};
+ while (lock.test_and_set()) {} /* We make sure we don't abort from multiple threads. */
+ ::dux::dbglog("dux :: abrt :: Aborting!\n");
+ if (::dux::haserr()) {::dux::dbglog("dux :: abrt :: Last error: %s\n",::dux::errcdnm(::dux::geterr()));}
+ ::dux::setsighandl(::dux::sig::abrt,::dux::sighandl::dfl());
+ ::dux::raise(::dux::sig::abrt); /* Raise SIGABRT to call the default signal handler. */
+ ::dux::trap(); /* The default signal handler returned, so we will trap as we can't return. */
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" dux_attr_cold auto dux_abrt() -> void {::dux::abrt();}
diff --git a/dux/src/alloc.cc b/dux/src/alloc.cc
new file mode 100644
index 0000000..278b095
--- /dev/null
+++ b/dux/src/alloc.cc
@@ -0,0 +1,28 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+
+# include <cstddef>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_alloc(::dux::uwrd const _sz) -> void * {return ::dux_priv_alloc(_sz,alignof (::std::max_align_t));}
diff --git a/dux/src/errcdnm.cc b/dux/src/errcdnm.cc
new file mode 100644
index 0000000..8401c28
--- /dev/null
+++ b/dux/src/errcdnm.cc
@@ -0,0 +1,24 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_errcdnm(::dux::errcd const _cd) -> ::dux::str {return ::dux::errcdnm(_cd);}
diff --git a/dux/src/exit.cc b/dux/src/exit.cc
new file mode 100644
index 0000000..9e3bd74
--- /dev/null
+++ b/dux/src/exit.cc
@@ -0,0 +1,71 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <sys/types.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+auto ::dux::exit(::dux::stat const _stat) noexcept -> void {
+# if defined(dux_os_linux)
+ if (::dux_priv_posix_getpid() != static_cast<::pid_t>(::dux::syscall(__NR_gettid))) [[unlikely]] { /* Check if calling thread is also the main thread. Only thread exit is allowed outside the main thread. */
+ ::dux::dbglog("dux :: \x1B[91mexit\x1B[0m :: Standard exit invoked outside main thread!\n");
+ ::dux::abrt();
+ }
+# endif
+ ::dux::priv::exitlock.store(true);
+ ::dux::priv::exitstat = _stat;
+ ::std::longjmp(::dux::priv::exitjmp,0x1);
+}
+
+auto ::dux::exit(::dux::stat const _stat,::dux::priv::qexit) noexcept -> void {
+ using ::dux::priv::exitlock;
+ if (exitlock.load()) [[unlikely]] {for (;;) {}}
+ exitlock.store(true);
+ auto const stat {static_cast<int>(_stat)};
+ for (;;) {
+# if defined(dux_os_freebsd)
+ ::dux::syscall(SYS_exit,stat);
+# elif defined(dux_os_linux)
+ ::dux::syscall(__NR_exit_group,stat);
+ ::dux::syscall(__NR_exit,stat);
+# endif
+ }
+}
+
+auto ::dux::exit(::dux::stat const _stat,::dux::priv::thrdexit) noexcept -> void {
+ auto const stat {static_cast<int>(_stat)};
+ for (;;) {
+# if defined(dux_os_freebsd)
+ ::dux::syscall(SYS_exit,stat);
+# elif defined(dux_os_linux)
+ ::dux::syscall(__NR_exit,stat);
+# endif
+ }
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" dux_attr_cold auto dux_exit( ::dux::stat const _stat) -> void {::dux::exit(_stat);}
+extern "C" dux_attr_cold auto dux_qexit( ::dux::stat const _stat) -> void {::dux::exit(_stat,::dux::qexit);}
+extern "C" dux_attr_cold auto dux_thrdexit(::dux::stat const _stat) -> void {::dux::exit(_stat,::dux::thrdexit);}
diff --git a/include/dux/io.d/dbgprint.hh b/dux/src/fndchr.cc
index 3e9d0cd..ec06041 100644
--- a/include/dux/io.d/dbgprint.hh
+++ b/dux/src/fndchr.cc
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,8 +17,18 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<typename... Ts> constexpr auto ::dux::dbgprint(::dux::str const & _str,Ts... _args) -> void {
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_fndchr(char const * const restrict _str,int const _chr) -> ::dux_priv_uwrd {
if constexpr (::dux::dbg) {
- ::dux::print(_str,_args...);
+ if (_chr >= ::dux::maxval<char>) [[unlikely]] {
+ ::dux::seterr(::dux::errcd::illparam);
+ return dux_uwrdl(-0x1);
+ }
}
+ return ::dux::fndchr(_str,static_cast<char>(_chr));
}
diff --git a/dux/src/free.cc b/dux/src/free.cc
new file mode 100644
index 0000000..90cade5
--- /dev/null
+++ b/dux/src/free.cc
@@ -0,0 +1,30 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+
+# include <dux/sig>
+
+auto ::dux::free(::dux::nullptrtyp) noexcept -> void {
+ ::dux::dbglog("dux :: free :: Address 0x0 is not freeable!\n");
+ ::dux::raise(::dux::sig::segv);
+ ::dux::unreach(); /* SIGSEGV handlers may not return, so we can guarantee that this function also never returns. */
+}
diff --git a/include/dux/media b/dux/src/freernd.cc
index bd00493..5325fb1 100644
--- a/include/dux/media
+++ b/dux/src/freernd.cc
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,10 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_media)
-#define dux_hdr_media
+# include <dux/priv>
-#include <dux/sys>
+# include <dux/math>
-#include <dux/media.hh>
+# include <dux/mem>
-#endif
+auto ::dux::priv::freernd(::dux::uint8 * const restrict _ptr) noexcept -> void {::dux::free(_ptr);}
diff --git a/dux/src/getallocsz.cc b/dux/src/getallocsz.cc
new file mode 100644
index 0000000..db7de87
--- /dev/null
+++ b/dux/src/getallocsz.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+
+# include <dux/seq>
+
+auto ::dux::priv::getallocsz([[maybe_unused]] void * const restrict _ptr) noexcept -> ::dux::uwrd {return dux_uwrdl(-0x1);} /* TO-DO: Implement. */
diff --git a/dux/src/getenv.cc b/dux/src/getenv.cc
new file mode 100644
index 0000000..06a21e8
--- /dev/null
+++ b/dux/src/getenv.cc
@@ -0,0 +1,55 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+extern char * * environ;
+
+auto ::dux::getenv(char const * const restrict _envvarname) noexcept -> ::dux::str {
+ ::dux::str str;
+ constexpr auto envvarnamebufsz {dux_uwrdl(0xFF)};
+ static char envvarnamebuf[envvarnamebufsz];
+ if (environ == nullptr) [[unlikely]] {
+ str.ptr = nullptr;
+ return str;
+ }
+ for (auto envvars = const_cast<char const * const *>(environ);*envvars != nullptr;++envvars) {
+ auto envvar = *envvars;
+ auto const eqpos = ::dux::fndchr(envvar,'=');
+ auto envvarname = envvarnamebuf;
+ ::dux::cpy(envvar,eqpos,envvarname);
+ envvarname[eqpos] = '\u0000';
+ if (::dux::streq(envvarname,_envvarname)) [[unlikely]] {
+ str.ptr = envvar + eqpos + dux_uwrdl(0x1);
+ str.sz = eqpos;
+ ::dux::dbglog("dux :: getenv :: Got value of environment variable %s: \"%s\"\n",_envvarname,str.ptr);
+ return str;
+ }
+ }
+ str.ptr = "";
+ str.sz = dux_uwrdl(0x0);
+ ::dux::dbglog("dux :: getenv :: Environment variable %s did not exist!\n",_envvarname);
+ return str;
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_getenv(char const * const restrict _envvarname) -> ::dux::str {return ::dux::getenv(_envvarname);}
diff --git a/dux/src/getmainparam.cc b/dux/src/getmainparam.cc
new file mode 100644
index 0000000..e25311f
--- /dev/null
+++ b/dux/src/getmainparam.cc
@@ -0,0 +1,24 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_getmainparam(void const * const _params,::dux::uwrd const _n) noexcept -> ::dux::str {return static_cast<::dux::mainparams const *>(_params)->param(_n);}
diff --git a/dux/src/getnummainparams.cc b/dux/src/getnummainparams.cc
new file mode 100644
index 0000000..e1c2532
--- /dev/null
+++ b/dux/src/getnummainparams.cc
@@ -0,0 +1,24 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_getnummainparams(void const * const _params) noexcept -> ::dux::uwrd {return static_cast<::dux::mainparams const *>(_params)->num();}
diff --git a/dux/src/gettime.cc b/dux/src/gettime.cc
new file mode 100644
index 0000000..75b7d4b
--- /dev/null
+++ b/dux/src/gettime.cc
@@ -0,0 +1,41 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/time>
+
+# include <time.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+static_assert(sizeof (::time_t) * dux_bytesz >= dux_uwrdl(0x40),"The size of the system type (time_t) must be eqaul to or larger than our replacement type's size.");
+
+auto ::dux::gettime() noexcept -> ::dux::sint64 {
+ struct timespec timespec {};
+ ::dux_priv_posix_clock_gettime(CLOCK_REALTIME,&timespec);
+ return static_cast<::dux::sint64>(timespec.tv_sec);
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_gettime() -> ::dux::sint64 {return ::dux::gettime();}
diff --git a/dux/src/mainparams.cc b/dux/src/mainparams.cc
new file mode 100644
index 0000000..e00e62e
--- /dev/null
+++ b/dux/src/mainparams.cc
@@ -0,0 +1,57 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+::dux::mainparams::mainparams() noexcept {this->_alloc = false;}
+
+::dux::mainparams::~mainparams() noexcept {if (this->_alloc) {::dux::free(this->_params);}}
+
+auto ::dux::mainparams::fromstd(int const argc,char const * const * const argv) noexcept -> void {
+ this->~mainparams();
+ if (argc == 0x0) [[unlikely]] {
+ this->_params = nullptr;
+ this->_num = dux_uwrdl(0x0);
+ return;
+ }
+ this->_num = {static_cast<::dux::uwrd>(argc)};
+ this->_params = ::dux::alloc<::dux::str>(this->_num);
+ if (::dux::geterr() != ::dux::errcd::noerr) [[unlikely]] {return;}
+ this->_alloc = true;
+ for (auto n {dux_uwrdl(0x0)};n < this->_num;++n) {
+ auto & param {this->_params[n]};
+ param.ptr = argv[n];
+ param.sz = ::dux::strlen(param.ptr);
+ }
+}
+
+auto ::dux::mainparams::num() const noexcept -> ::dux::uwrd {return this->_num;}
+
+auto ::dux::mainparams::param(::dux::uwrd const _n) const noexcept -> ::dux::str {
+ if (_n >= _num) [[unlikely]] {
+ ::dux::str str;
+ str.ptr = nullptr;
+ str.sz = dux_uwrdl(0x0);
+ ::dux::seterr(::dux::errcd::outofrange);
+ return str;
+ }
+ return this->_params[_n];
+}
diff --git a/dux/src/onexit.cc b/dux/src/onexit.cc
new file mode 100644
index 0000000..93c24af
--- /dev/null
+++ b/dux/src/onexit.cc
@@ -0,0 +1,55 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <atomic>
+
+auto ::dux::onexit(::dux::priv::onexitfn const _fn) noexcept -> void {
+ if (::dux::priv::exitlock.load()) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91monexit\x1B[0m :: Invoked after exit!\n");
+ ::dux::seterr(::dux::errcd::illcallseq);
+ return;
+ }
+ using ::dux::priv::onexitlock;
+ {
+ while (onexitlock.load()) {} /* Wait for other threads to register onexit functions. */
+ onexitlock.store(true);
+ using ::dux::priv::onexitfns;
+ using ::dux::priv::numonexitfns;
+ for (auto n {dux_uwrdl(0x0)};n < numonexitfns;++n) {if (onexitfns[n] == _fn) [[unlikely]] {
+ ::dux::dbglog("dux :: onexit :: Function at %p has already been registered!\n",reinterpret_cast<void *>(_fn));
+ goto ret;
+ }}
+ if (numonexitfns == ::dux::priv::maxnumonexitfns) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91monexit\x1B[0m :: Function at %p cannot be registered as limit (%zu) has been reached!\n",reinterpret_cast<void *>(_fn),::dux::priv::maxnumonexitfns);
+ ::dux::seterr(::dux::errcd::nospc);
+ goto ret;
+ }
+ ::dux::dbglog("dux :: onexit :: Registering function at %p!\n",reinterpret_cast<void *>(_fn));
+ ++numonexitfns;
+ onexitfns[numonexitfns - 0x1] = _fn;
+ }
+ret:;
+ onexitlock.store(false);
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" dux_attr_cold auto dux_onexit(::dux::priv::onexitfn const _fn) {::dux::onexit(_fn);}
diff --git a/dux/src/priv/alloc.cc b/dux/src/priv/alloc.cc
new file mode 100644
index 0000000..26dfa96
--- /dev/null
+++ b/dux/src/priv/alloc.cc
@@ -0,0 +1,40 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+
+# include <cstddef>
+# include <cstdlib>
+# include <stdlib.h>
+
+extern "C" auto dux_priv_alloc(::dux::uwrd const _sz,::dux::uwrd const _align) -> void * { /* Currently, we implement memory using the standard C++ functions. Implement our own runtime system. */
+ if (_sz == dux_uwrdl(0x0)) [[unlikely]] {return nullptr;}
+ auto const ptr {[&_align,&_sz] {
+ if (_align == alignof (::std::max_align_t)) {return ::std::malloc(_sz);}
+ return ::std::aligned_alloc(_align,_sz);
+ }()};
+ if (ptr == nullptr) [[unlikely]] {goto badalloc;}
+ dux_ass("",reinterpret_cast<::dux::uwrd>(ptr) % _align == dux_uwrdl(0x0)); /* Make sure the pointer is aligned. */
+ return ptr;
+badalloc:;
+ ::dux::seterr(::dux::errcd::badalloc);
+ return nullptr;
+}
diff --git a/dux/src/priv/assfail.c b/dux/src/priv/assfail.c
new file mode 100644
index 0000000..f0ba07d
--- /dev/null
+++ b/dux/src/priv/assfail.c
@@ -0,0 +1,36 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+void dux_priv_assfail(char const * const restrict _filenm,unsigned long const _ln,char const * const restrict _fn,char const * const restrict _msg,char const * const restrict _exprstr) {
+ /* We will call dux_priv_dbglog directly, as we must print, even if debug mode is enabled. */
+ dux_priv_dbglog("\n");
+ dux_priv_dbglog("Assertion \x1B[38;2;225;61;61mfailed\x1B[0m");
+ if (dux_streq(_msg,"")) {dux_priv_dbglog("!");}
+ else {dux_priv_dbglog(": \x1B[3m%s\x1B[0m",_msg);}
+ dux_priv_dbglog("\n");
+ dux_priv_dbglog(" Expression (\x1B[38;2;61;225;169m%s\x1B[0m) does not evaluate to true!\n",_exprstr);
+ dux_priv_dbglog(" ... at \x1B[38;2;225;169;61m\"%s\"\x1B[0m:\x1B[38;2;255;169;61m%li\x1B[0m\n",_filenm,_ln);
+ dux_priv_dbglog(" ... in \x1B[38;2;169;225;61m%s\x1B[0m\n",_fn);
+ dux_priv_dbglog("\n");
+ dux_abrt();
+}
diff --git a/dux/src/priv/cpy.c b/dux/src/priv/cpy.c
new file mode 100644
index 0000000..490d101
--- /dev/null
+++ b/dux/src/priv/cpy.c
@@ -0,0 +1,42 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/seq>
+
+void dux_priv_cpy(void const * const restrict _in,dux_uwrd const _num,void * const restrict _out,dux_uwrd const _sz) {
+# if dux_dbg
+ dux_unlikely (_in == dux_nullptr || _out == dux_nullptr) {
+ dux_seterr(dux_errcd_badaddr);
+ return;
+ }
+# endif
+ dux_uwrd const numbyte = _num * _sz;
+# if dux_hasbuiltin(__builtin_memcpy) /* We would like to use this builtin, if available, as it may be optimised in a way which would be UB if we did it. */
+ dux_ppmsg("Using __builtin_memcpy for dux_cpy.")
+ __builtin_memcpy((void *)_out,(void *)_in,numbyte);
+# else
+ unsigned char const * const restrict in = (unsigned char const *)_in;
+ unsigned char * const restrict out = (unsigned char *)_out;
+ for (dux_uwrd n = dux_uwrdl(0x0);n < numbyte;++n) {
+ *(unsigned char *)&out[n] = *(unsigned char const *)&in[n];
+ }
+# endif
+}
diff --git a/include/dux/sys b/dux/src/priv/curerrcd.c
index 33dc533..b046e5c 100644
--- a/include/dux/sys
+++ b/dux/src/priv/curerrcd.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,6 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_sys)
-#define dux_hdr_sys
+# include <dux/priv>
-#include <dux/str>
-
-#include <dux/sys.hh>
-
-#endif
+_Thread_local enum dux_priv_errcd dux_priv_curerrcd;
diff --git a/src/dux/_freepthrdhandl.cc b/dux/src/priv/dbglog.c
index 9f499b5..7d88d72 100644
--- a/src/dux/_freepthrdhandl.cc
+++ b/dux/src/priv/dbglog.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,14 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <dux/thrd>
+# include <dux/priv>
-#include "priv.hh"
+# include <stdarg.h>
+# include <stdio.h>
-auto ::dux::_freepthrdhandl(void * const dux_restr _pthrdhandl) noexcept -> void {
- ::delete static_cast<::dux::_pthrddat *>(_pthrdhandl);
+void dux_priv_dbglog(char const * const restrict _str,...) {
+ va_list args;
+ va_start(args,_str);
+ vfprintf(stderr,_str,args);
+ va_end(args);
}
diff --git a/src/dux/getenv.cc b/dux/src/priv/dbgunreach.c
index fce63e2..de56e8c 100644
--- a/src/dux/getenv.cc
+++ b/dux/src/priv/dbgunreach.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,14 +17,15 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <cstdlib>
-#include <dux/sys>
+# include <dux/priv>
-auto ::dux::getenv(char const * const dux_restr _env) -> char const * {
- if (auto const envval = ::std::getenv(_env);envval == nullptr) [[unlikely]] {
- throw ::dux::runerr("Environment variable does not exist!");
- }
- else {
- return envval;
+# include <dux/str>
+
+void dux_priv_dbgunreach(char const * const restrict _file,long const _line) {
+ dux_dbglog("dux :: Unreachable point reached");
+ if (!dux_streq(_file,"") && _line != 0x0l) {
+ dux_dbglog(" at \"%s\":%li",_file,_line);
}
+ dux_dbglog("!\n");
+ dux_trap();
}
diff --git a/dux/src/priv/dup.c b/dux/src/priv/dup.c
new file mode 100644
index 0000000..25ec3f0
--- /dev/null
+++ b/dux/src/priv/dup.c
@@ -0,0 +1,39 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+# include <dux/seq>
+
+void * dux_priv_dup(void const * const restrict _in,dux_uwrd const _num,dux_uwrd const _sz) {
+# if dux_dbg
+ dux_unlikely (_in == dux_nullptr) {
+ dux_seterr(dux_errcd_badaddr);
+ return dux_nullptr;
+ }
+# endif
+ dux_unlikely (_num == dux_uwrdl(0x0)) {return dux_nullptr;}
+ dux_uwrd const numbyte = _num * _sz;
+ void * newarr = dux_alloc(numbyte);
+ dux_reseterr();
+ dux_unlikely (dux_haserr()) {return dux_nullptr;}
+ dux_cpy(_in,_num,newarr,_sz);
+ return newarr;
+}
diff --git a/dux/src/priv/fill.c b/dux/src/priv/fill.c
new file mode 100644
index 0000000..2495ca1
--- /dev/null
+++ b/dux/src/priv/fill.c
@@ -0,0 +1,46 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/seq>
+
+void dux_priv_fill(void * const restrict _ptr,dux_uwrd const _num,dux_uint8 const _val,dux_uwrd const _sz) {
+# if dux_dbg
+ dux_unlikely (_ptr == dux_nullptr) {
+ dux_seterr(dux_errcd_badaddr);
+ return;
+ }
+ dux_unlikely (_sz == dux_uwrdl(0x0)) {
+ dux_seterr(dux_errcd_illsz);
+ return;
+ }
+# endif
+ dux_unlikely (_num == dux_uwrdl(0x0)) {return;}
+ dux_uwrd const numbyte = _num * _sz;
+# if dux_hasbuiltin(__builtin_memset)
+ dux_ppmsg("Using __builtin_memset for dux_fill.")
+ __builtin_memset(_ptr,_val,numbyte);
+# else
+ dux_uint8 * const restrict ptr = (dux_uint8 *)_ptr;
+ for (dux_uwrd n = dux_uwrdl(0x0);n < numbyte;++n) {
+ ptr[n] = _val;
+ }
+# endif
+}
diff --git a/src/dux/exit.cc b/dux/src/priv/free.cc
index 3d0b15a..93e04b5 100644
--- a/src/dux/exit.cc
+++ b/dux/src/priv/free.cc
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,13 +17,15 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <dux/sys>
+# include <dux/priv>
-#include <cstdlib>
+# include <dux/mem>
-auto ::dux::exit(::dux::stat const _stat) noexcept -> void {
- if (_stat == ::dux::stat::err) {
- ::std::exit(EXIT_FAILURE);
- }
- ::std::exit(EXIT_SUCCESS);
+# include <dux/sig>
+
+# include <cstdlib>
+
+extern "C" auto dux_priv_free(void * const restrict _ptr) -> void {
+ if constexpr (::dux::dbg) {if (_ptr == nullptr) [[unlikely]] {::dux::free(nullptr);}}
+ ::std::free(static_cast<::dux::uint8 *>(_ptr));
}
diff --git a/dux/src/priv/geterrnoptr.c b/dux/src/priv/geterrnoptr.c
new file mode 100644
index 0000000..a94bf48
--- /dev/null
+++ b/dux/src/priv/geterrnoptr.c
@@ -0,0 +1,35 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# if defined(dux_os_freebsd)
+dux_attr_const int * __error(void);
+# elif defined(dux_os_linux)
+dux_attr_const int * __errno_location(void);
+# endif
+
+int * dux_priv_geterrnoptr(void) {
+# if defined(dux_os_freebsd)
+ return __error();
+# elif defined(dux_os_linux)
+ return __errno_location();
+# endif
+}
+
diff --git a/dux/src/priv/logstderr.c b/dux/src/priv/logstderr.c
new file mode 100644
index 0000000..2263dff
--- /dev/null
+++ b/dux/src/priv/logstderr.c
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# include <unistd.h>
+
+void dux_priv_logstderr(char const * const restrict _str) {dux_priv_posix_write(STDERR_FILENO,_str,dux_strlen(_str));}
diff --git a/include/dux/cstr b/dux/src/priv/nomedia.c
index 2089c7c..26e19bf 100644
--- a/include/dux/cstr
+++ b/dux/src/priv/nomedia.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,10 +17,11 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#if !defined(dux_hdr_cstr)
-#define dux_hdr_cstr
+# include <dux/priv>
-#include <dux/algo>
-#include <dux/cstr.hh>
-
-#endif
+bool const dux_priv_nomedia =
+# if defined(dux_priv_dis_media)
+ true;
+# else
+ false;
+# endif
diff --git a/include/dux/algo.d/filln.hh b/dux/src/priv/plot.c
index f2d6988..36f38a9 100644
--- a/include/dux/algo.d/filln.hh
+++ b/dux/src/priv/plot.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,12 +17,22 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<typename T,typename T0> constexpr auto ::dux::filln(T * const dux_restr _in,::dux::usz const _num,T0 const _val) noexcept -> void {
- if (!_num) [[unlikely]] {
+# include <dux/priv>
+
+# include <dux/seq>
+
+void dux_priv_plot(void const * const restrict _ptr,dux_uwrd const _num,dux_uwrd const _sz,void (* const _fn)(void const * ptr)) {
+# if dux_dbg
+ dux_unlikely (_ptr == dux_nullptr) {
+ dux_seterr(dux_errcd_badaddr);
return;
}
- auto const val = static_cast<T>(_val);
- for (auto pos = 0x0uz;pos < _num;pos += 0x1uz) {
- _in[pos] = val;
+ dux_unlikely (_sz == dux_uwrdl(0x0)) {
+ dux_seterr(dux_errcd_illsz);
+ return;
}
+# endif
+ dux_unlikely (_num == dux_uwrdl(0x0)) {return;}
+ dux_uwrd const numbyte = _num * _sz;
+ for (dux_uwrd n = dux_uwrdl(0x0);n < numbyte;n += _sz) {_fn((dux_uint8 *)_ptr + n);}
}
diff --git a/dux/src/priv/posix/clock_gettime.c b/dux/src/priv/posix/clock_gettime.c
new file mode 100644
index 0000000..6210c5c
--- /dev/null
+++ b/dux/src/priv/posix/clock_gettime.c
@@ -0,0 +1,35 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <time.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+int dux_priv_posix_clock_gettime(clockid_t const clockid,struct timespec * const tp) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_clock_gettime,clockid,tp);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_clock_gettime,clockid,tp);
+# endif
+}
diff --git a/include/dux/algo.d/renew.hh b/dux/src/priv/posix/close.c
index 681a337..68dd2d1 100644
--- a/include/dux/algo.d/renew.hh
+++ b/dux/src/priv/posix/close.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,9 +17,18 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<typename T> constexpr auto ::dux::renew(T * const dux_restr _ptr,::dux::usz const _sz,::dux::usz const _newsz) -> T * {
- T * const dux_restr ptr = ::new T[_newsz]();
- ::dux::cpyn(_ptr,::dux::min(_sz,_newsz),ptr);
- ::delete[] _ptr;
- return ptr;
+# include <dux/priv>
+
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+int dux_priv_posix_close(int const fildes) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_close,fildes);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_close,fildes);
+# endif
}
diff --git a/dux/src/priv/posix/getpid.c b/dux/src/priv/posix/getpid.c
new file mode 100644
index 0000000..c7fa17d
--- /dev/null
+++ b/dux/src/priv/posix/getpid.c
@@ -0,0 +1,35 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <sys/types.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+pid_t dux_priv_posix_getpid(void) {
+# if defined(dux_os_freebsd)
+ return (pid_t)dux_syscall(SYS_getpid);
+# elif defined(dux_os_linux)
+ return (pid_t)dux_syscall(__NR_getpid);
+# endif
+}
diff --git a/src/dux/_pthrdcrt.cc b/dux/src/priv/posix/getrandom.c
index cb9a652..ccedaaf 100644
--- a/src/dux/_pthrdcrt.cc
+++ b/dux/src/priv/posix/getrandom.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,14 +17,18 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <dux/thrd>
-#include <pthread.h>
+# include <dux/priv>
-#include "priv.hh"
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
-auto ::dux::_pthrdcrt(void * const dux_restr _pthrdhandl,auto (* _fn)(void *) -> void *,void const * const dux_restr _arg) -> void {
- [[maybe_unused]] auto const thrddat = static_cast<::dux::_pthrddat *>(_pthrdhandl);
- if (::pthread_create(&thrddat->pthrd,nullptr,_fn,const_cast<void *>(_arg)) != 0x0) [[unlikely]] {
- throw ::dux::thrderr("Unable to initiate thread!");
- }
+dux_swrd dux_priv_posix_getrandom(void * const buf,dux_uwrd const buflen,unsigned int flags) {
+# if defined(dux_os_freebsd)
+ return (dux_swrd)dux_syscall(SYS_getrandom,buf,buflen,flags);
+# elif defined(dux_os_linux)
+ return (dux_swrd)dux_syscall(__NR_getrandom,buf,buflen,flags);
+# endif
}
diff --git a/src/dux/_pthrdjoin.cc b/dux/src/priv/posix/kill.c
index 33266ee..be1534b 100644
--- a/src/dux/_pthrdjoin.cc
+++ b/dux/src/priv/posix/kill.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,16 +17,19 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <dux/thrd>
-#include <pthread.h>
+# include <dux/priv>
-#include "priv.hh"
+# include <sys/types.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
-auto ::dux::_pthrdjoin(void * const dux_restr _pthrdhandl) -> void * {
- [[maybe_unused]] auto const thrddat = static_cast<::dux::_pthrddat *>(_pthrdhandl);
- void * ret{nullptr};
- if (::pthread_join(thrddat->pthrd,&ret) != 0x0) [[unlikely]] {
- throw ::dux::thrderr("Unable to join thread!");
- }
- return ret;
+int dux_priv_posix_kill(pid_t const pid,int const sig) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_kill,pid,sig);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_kill,pid,sig);
+# endif
}
diff --git a/dux/src/priv/posix/mmap.c b/dux/src/priv/posix/mmap.c
new file mode 100644
index 0000000..7361653
--- /dev/null
+++ b/dux/src/priv/posix/mmap.c
@@ -0,0 +1,31 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <sys/mman.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+void * dux_priv_posix_mmap(void * const addr,dux_uwrd const length,int const prot,int const flags,int const fd,off_t const offset) {
+ return mmap(addr,length,prot,flags,fd,offset);
+}
diff --git a/dux/src/priv/posix/nanosleep.c b/dux/src/priv/posix/nanosleep.c
new file mode 100644
index 0000000..14cb940
--- /dev/null
+++ b/dux/src/priv/posix/nanosleep.c
@@ -0,0 +1,35 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <time.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+int dux_priv_posix_nanosleep(struct timespec const * const req,struct timespec * const rem) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_nanosleep,req,rem);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_nanosleep,req,rem);
+# endif
+}
diff --git a/dux/src/priv/posix/openat.c b/dux/src/priv/posix/openat.c
new file mode 100644
index 0000000..2ae2a13
--- /dev/null
+++ b/dux/src/priv/posix/openat.c
@@ -0,0 +1,34 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+int dux_priv_posix_openat(int const fd,char const * const pathname,int const flags) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_open,fd,pathname,flags);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_open,fd,pathname,flags);
+# endif
+}
diff --git a/dux/src/priv/posix/sigaction.c b/dux/src/priv/posix/sigaction.c
new file mode 100644
index 0000000..807d44c
--- /dev/null
+++ b/dux/src/priv/posix/sigaction.c
@@ -0,0 +1,37 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/seq>
+
+# include <signal.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+int dux_priv_posix_sigaction(int const signum,struct sigaction const * const act,struct sigaction * const oldact) {
+# if defined(dux_os_freebsd)
+ return (int)dux_syscall(SYS_sigaction,signum,act,oldact);
+# elif defined(dux_os_linux)
+ return (int)dux_syscall(__NR_rt_sigaction,signum,act,oldact,sizeof (sigset_t));
+# endif
+}
diff --git a/dux/src/priv/posix/write.c b/dux/src/priv/posix/write.c
new file mode 100644
index 0000000..de80921
--- /dev/null
+++ b/dux/src/priv/posix/write.c
@@ -0,0 +1,34 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+dux_swrd dux_priv_posix_write(int const fildes,void const * const buf,dux_uwrd const nbyte) {
+# if defined(dux_os_freebsd)
+ return (dux_swrd)dux_syscall(SYS_write,fildes,buf,nbyte);
+# elif defined(dux_os_linux)
+ return (dux_swrd)dux_syscall(__NR_write,fildes,buf,nbyte);
+# endif
+}
diff --git a/dux/src/priv/start.cc b/dux/src/priv/start.cc
new file mode 100644
index 0000000..29f2a95
--- /dev/null
+++ b/dux/src/priv/start.cc
@@ -0,0 +1,65 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/mem>
+# include <dux/sig>
+
+# include <csetjmp>
+
+auto main(int const argc,char const * const * const argv) -> int {return ::dux_priv_start(argc,argv);}
+
+extern "C" auto dux_main(::dux::mainparams const *) -> ::dux::stat;
+
+extern "C" auto dux_priv_start(int const argc,char const * const * const argv) -> int {
+ ::dux::dbglog("dux :: priv.start :: Bootstrapping!\n");
+ ::dux::mainparams mainparams;
+ mainparams.fromstd(argc,argv);
+ ::dux::stat volatile stat;
+ if (setjmp(::dux::priv::exitjmp) == 0x0) {
+ try {stat = ::dux_main(&mainparams);}
+ catch (...) {
+ ::dux::dbglog("dux :: \x1B[91mpriv.start\x1B[0m :: Exception was not caught!\n");
+ ::dux::abrt();
+ }
+ ::dux::priv::exitlock.store(true); /* Disable all future exits. */
+ ::dux::dbglog("dux :: priv.start :: Program returned!\n");
+ }
+ else {stat = ::dux::priv::exitstat;}
+ while (::dux::priv::onexitlock.load()) {} /* Wait for the remaining onexit function to be registered, if any. */
+ if (::dux::priv::numonexitfns > dux_uwrdl(0x0)) {
+ using ::dux::priv::onexitfns;
+ for (::dux::uwrd n {::dux::priv::numonexitfns};n > 0x0;--n) {
+ auto const fn {onexitfns[n - dux_uwrdl(0x1)]};
+ ::dux::dbglog("dux :: exit :: Calling registered function #%zu at %p!\n",n - dux_uwrdl(0x1),reinterpret_cast<void *>(fn));
+ if (fn == nullptr) [[unlikely]] {
+ ::dux::dbglog("dux :: exit :: Registered function is invalid (address is null)!\n");
+ ::dux::raise(::dux::sig::segv);
+ }
+ try {fn(stat);} /* Registered functions may not throw exceptions. */
+ catch (...) {
+ ::dux_priv_logstderr("dux :: exit :: Registered function threw an exception!\n");
+ ::dux::abrt();
+ }
+ }
+ }
+ ::dux::dbglog("dux :: exit :: Exiting with system code (%i)!\n",static_cast<int>(stat));
+ return static_cast<int>(stat);
+}
diff --git a/dux/src/priv/syscall.S b/dux/src/priv/syscall.S
new file mode 100644
index 0000000..2ec5e36
--- /dev/null
+++ b/dux/src/priv/syscall.S
@@ -0,0 +1,50 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/sysinfo.h>
+
+.globl dux_priv_syscall
+
+dux_priv_syscall:
+# if defined(dux_arch_arm)
+# if dux_wrdsz == 0x40
+ mov w8,w0
+ mov x0,x1
+ mov x1,x2
+ mov x2,x3
+ mov x3,x4
+ mov x4,x5
+ mov x5,x6
+ svc #0
+ ret
+# endif
+# elif defined(dux_arch_x86)
+# if dux_wrdsz == 0x40
+ .intel_syntax noprefix
+ mov rax,rdi /* Move first parameter (the syscall id) to rax. */
+ mov rdi,rsi /* Shift all parameters. */
+ mov rsi,rdx
+ mov rdx,rcx
+ mov r10,r8 /* Syscalls use r10 instead of rcx. */
+ mov r8,r9
+ mov r9,[rsp - 0x8] /* Extract the sixth argument from the stack. */
+ syscall /* Slime incident */
+ ret
+# endif
+# endif
diff --git a/dux/src/raise.cc b/dux/src/raise.cc
new file mode 100644
index 0000000..687eada
--- /dev/null
+++ b/dux/src/raise.cc
@@ -0,0 +1,45 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/sig>
+
+# include <sys/types.h>
+
+auto ::dux::raise(::dux::sig const _sig) noexcept -> void {
+ auto const syssig = static_cast<int>(_sig);
+ ::dux::dbglog("dux :: raise :: Raising signal #%i!\n",syssig);
+# if defined(dux_priv_nosigtrap)
+ switch (_sig) {
+ [[likely]] default:
+ break;
+ case ::dux::sig::term:
+ ::dux_priv_dbglog("dux :: raise :: Terminated!\n");
+ ::dux::exit(::dux::stat::err);
+ case ::dux::sig::trap:
+ ::dux::trap();
+ }
+# endif
+ ::dux_priv_posix_kill(::dux_priv_posix_getpid(),syssig);
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_raise(dux_priv_sig const _sig) -> void {return ::dux::raise(static_cast<::dux::sig>(_sig));}
diff --git a/dux/src/realloc.cc b/dux/src/realloc.cc
new file mode 100644
index 0000000..0e65b3a
--- /dev/null
+++ b/dux/src/realloc.cc
@@ -0,0 +1,36 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/sig>
+# include <dux/mem>
+
+# include <cstddef>
+# include <cstdlib>
+
+auto ::dux::priv::realloc(void * const restrict _ptr,::dux::uwrd const _newsz) noexcept -> void * {
+ if (reinterpret_cast<::dux::uwrd>(_ptr) % alignof (::std::max_align_t) != dux_uwrdl(0x0)) [[unlikely]] {
+ ::dux::dbglog("dux :: realloc :: Address %p is not default-aligned and cannot be reallocated in the current version of dux!\n",_ptr);
+ ::dux::raise(::dux::sig::segv);
+ }
+ auto const newptr {::std::realloc(const_cast<void *>(_ptr),_newsz)};
+ if (::dux::haserr()) [[unlikely]] {return nullptr;}
+ return newptr;
+}
diff --git a/include/dux/algo.d/cpyn.hh b/dux/src/rnd.cc
index 6049fab..4fdd940 100644
--- a/include/dux/algo.d/cpyn.hh
+++ b/dux/src/rnd.cc
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,23 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-template<typename T> constexpr auto ::dux::cpyn(T const * const dux_restr _in,::dux::usz const _num,T * const _out) noexcept -> void {
- if (!_num) [[unlikely]] {
+# include <dux/priv>
+
+# include <dux/math>
+
+# include <sys/random.h>
+# if defined(dux_os_freebsd)
+# include <errno.h>
+# elif defined(dux_os_linux)
+# include <linux/errno.h>
+# endif
+
+auto ::dux::priv::rnd(::dux::uint8 * const restrict _buf,::dux::uwrd const _sz) noexcept -> void {
+getrnd:;
+ auto const getrndret = ::dux_priv_posix_getrandom(_buf,_sz,GRND_NONBLOCK);
+ if (getrndret == dux_swrdl(-0x1)) [[unlikely]] {
+ if (dux_priv_errno == EAGAIN) [[likely]] {goto getrnd;} /* We specify this as likely to speed this loop up. */
return;
}
- for (auto pos = 0x0uz;pos < _num;pos += 0x1uz) {
- _out[pos] = _in[pos];
- }
+ dux_ass("",static_cast<::dux::uwrd>(getrndret) == _sz);
}
diff --git a/dux/src/setsighandl.cc b/dux/src/setsighandl.cc
new file mode 100644
index 0000000..064743b
--- /dev/null
+++ b/dux/src/setsighandl.cc
@@ -0,0 +1,109 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/sig>
+
+# include <signal.h>
+# if defined(dux_os_freebsd)
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# endif
+
+namespace dux::local {
+ static ::dux::sighandl sighandls[static_cast<::dux::uwrd>(::dux::numsig)] {};
+}
+
+auto ::dux::setsighandl(::dux::sig const _sig,::dux::sighandl const _handl) noexcept -> void {
+ switch (_sig) { /* We don't allow signal handler to be registered for every signal. */
+ [[likely]] default:
+ break;
+ case ::dux::sig::abrt:
+ [[fallthrough]];
+ case ::dux::sig::kill:
+ [[fallthrough]];
+ case ::dux::sig::trap:
+ if (!_handl._isdfl) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91msetsighandl\x1B[0m :: Attempted setting custom signal handler for SIGABRT, SIGKILL or SIGTRAP (not allowed)!\n");
+ ::dux::seterr(::dux::errcd::badperms);
+ return;
+ }
+ }
+ if constexpr (::dux::dbg) {
+ if (!_handl._isdfl) {
+ if (_handl.handl == nullptr) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91msetsighandl\x1B[0m :: Handler invalid (address is null)!\n");
+ ::dux::seterr(::dux::errcd::illparam);
+ return;
+ }
+ }
+ }
+ ::dux::local::sighandls[static_cast<::dux::uwrd>(_sig)] = _handl;
+ auto const sig {static_cast<int>(_sig)};
+ {
+ auto handlwrap {[](int const _sig) {
+ auto const & handl {::dux::local::sighandls[static_cast<::dux::uwrd>(_sig)]};
+ auto const handlret {handl.handl(static_cast<::dux::sig>(_sig))};
+ auto const handlptr {reinterpret_cast<void *>(handl.handl)};
+ if (handlret) [[unlikely]] {
+ ::dux::dbglog("dux :: \x1B[91mraise\x1B[0m :: Signal handler for #%i (at %p) indicated error!\n",_sig,handlptr);
+ ::dux::abrt();
+ }
+ switch (_sig) {
+ [[likely]] default:
+ break;
+ case SIGFPE:
+ [[fallthrough]];
+ case SIGILL:
+ [[fallthrough]];
+ case SIGSEGV:
+ ::dux::dbglog("dux :: \x1B[91mraise\x1B[0m :: Signal handler for SIGFPE, SIGILL or SIGSEGV (at %p) returned and did not indicate error (not allowed)!\n",handlptr);
+ ::dux::abrt();
+ }
+ }};
+ struct ::sigaction sigact {};
+ if (_handl == ::dux::sighandl::dfl()) {
+ ::dux::dbglog("dux :: setsighandl :: Setting default signal handler for signal #%i!\n",sig);
+ sigact.sa_handler = SIG_DFL;
+ }
+ else {
+ ::dux::dbglog("dux :: setsighandl :: Setting signal handler (at %p) for signal #%i!\n",_handl.handl,sig);
+ sigact.sa_handler = handlwrap;
+ }
+ ::sigemptyset(&sigact.sa_mask);
+ sigact.sa_flags = SA_RESTART;
+ struct ::sigaction oldsigact;
+ if (::sigaction(sig,&sigact,&oldsigact) == -0x1) [[unlikely]] { /* priv.posix.sigaction does not work for some reason on Linux, so we just use the POSIX function directly. */
+ ::dux::seterr(::dux::errcd::runerr);
+ return;
+ }
+ }
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_setsighandl(::dux_priv_sig const _sig,::dux_priv_ctyp_sighandl const _handl) -> void {
+ auto const cxxhandl {[&] {
+ if (_handl == dux_priv_dflcsighandl) {return ::dux::sighandl::dfl();}
+ return ::dux::sighandl {reinterpret_cast<auto (*)(::dux::sig) -> bool>(reinterpret_cast<void *>(_handl))};
+ }()};
+ ::dux::setsighandl(static_cast<::dux::sig>(_sig),cxxhandl);
+}
diff --git a/dux/src/sleep.cc b/dux/src/sleep.cc
new file mode 100644
index 0000000..63bde80
--- /dev/null
+++ b/dux/src/sleep.cc
@@ -0,0 +1,54 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/time>
+
+# include <time.h>
+# if defined(dux_os_freebsd)
+# include <errno.h>
+# include <sys/syscall.h>
+# elif defined(dux_os_linux)
+# include <linux/unistd.h>
+# include <linux/errno.h>
+# endif
+
+auto ::dux::sleep(::dux::uint64 const _sec) noexcept -> void {
+ struct timespec timespec {};
+ timespec.tv_sec = static_cast<::time_t>(_sec);
+ timespec.tv_nsec = 0x0l;
+ ::dux::dbglog("dux :: sleep :: Initiating sleep for (" dux_printfuint64 ") %s!\n",_sec,timespec.tv_sec == ::time_t {0x1} ? "second" : "seconds");
+ while (timespec.tv_sec > static_cast<::time_t>(0x0)) { /* In case the sleep was interrupted, we must sleep the remaining time away. */
+ if (::dux_priv_posix_nanosleep(&timespec,&timespec) == -0x1) [[unlikely]] {
+ if (dux_priv_errno == EINTR) {
+ ::dux::dbglog("dux :: sleep :: Sleep was interrupted! Slept for " dux_printfuint64 " %s.\n",static_cast<::dux::uint64>(timespec.tv_sec),timespec.tv_sec == ::time_t {0x1} ? "second" : "seconds");
+ continue;
+ }
+ ::dux::dbglog("dux :: \x1B[91msleep\x1B[0m :: Sleep failed!\n");
+ ::dux::seterr(::dux::errcd::runerr);
+ return;
+ }
+ break; /* If the sleep was not interrupted, the remaining time will not be written to timespec. As we already checked for errors, we know the sleep was successful. */
+ }
+}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_sleep(::dux::uint64 const _sec) -> void {::dux::sleep(_sec);}
diff --git a/dux/src/strcmp.cc b/dux/src/strcmp.cc
new file mode 100644
index 0000000..23647ff
--- /dev/null
+++ b/dux/src/strcmp.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_strcmp(char const * const restrict _lstr,char const * const restrict _rstr) -> ::dux::sint8 {return ::dux::strcmp(_lstr,_rstr);}
diff --git a/dux/src/strcpy.cc b/dux/src/strcpy.cc
new file mode 100644
index 0000000..ddb9271
--- /dev/null
+++ b/dux/src/strcpy.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_strcpy(char const * const restrict _src,char * const restrict _dest) -> void {::dux::strcpy(_src,_dest);}
diff --git a/dux/src/strdup.cc b/dux/src/strdup.cc
new file mode 100644
index 0000000..60fcffd
--- /dev/null
+++ b/dux/src/strdup.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_strdup(char const * const restrict _str) -> ::dux::str {return ::dux::strdup(_str);}
diff --git a/dux/src/streq.cc b/dux/src/streq.cc
new file mode 100644
index 0000000..e9c6d20
--- /dev/null
+++ b/dux/src/streq.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_streq(char const * const restrict _lstr,char const * const restrict _rstr) -> bool {return ::dux::streq(_lstr,_rstr);}
diff --git a/dux/src/strlen.cc b/dux/src/strlen.cc
new file mode 100644
index 0000000..ab22f2e
--- /dev/null
+++ b/dux/src/strlen.cc
@@ -0,0 +1,26 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen.
+
+ This file is part of dux.
+
+ dux 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.
+
+ dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+# include <dux/priv>
+
+# include <dux/str>
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_strlen(char const * const restrict _str) -> ::dux::uwrd {return ::dux::strlen(_str);}
diff --git a/include/dux/algo.d/isinf.hh b/dux/src/trap.cc
index e921cc8..af20cf4 100644
--- a/include/dux/algo.d/isinf.hh
+++ b/dux/src/trap.cc
@@ -1,5 +1,5 @@
/*
- Copyright 2021 Gabriel Jensen
+ Copyright 2021, 2022 Gabriel Jensen.
This file is part of dux.
@@ -17,11 +17,24 @@
along with dux. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <limits> /* ::std::numeric_limits */
+# include <dux/priv>
-template<::dux::arith T> constexpr auto ::dux::isinf(T const _val) noexcept -> bool {
- if (::std::numeric_limits<T>::has_infinity) {
- return _val == ::std::numeric_limits<T>::infinity();
+# include <dux/sig>
+
+auto ::dux::trap() noexcept -> void {
+ for (;;) {
+# if !defined(dux_priv_nosigtrap)
+ ::dux::raise(::dux::sig::trap); /* POSIX systems have a signal for trapping. Use it. */
+# elif defined(dux_arch_x86)
+ asm volatile ( /* x86 has an interrupt instruction. Use it. */
+ "int3\n"
+ );
+# elif dux_hasbuiltin(__builtin_trap)
+ ::__builtin_trap();
+# endif
}
- return false;
}
+
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+
+extern "C" auto dux_trap() -> void {::dux::trap();}
diff --git a/include/dux/algo.d/cpy.hh b/include/dux/algo.d/cpy.hh
deleted file mode 100644
index 5e287c9..0000000
--- a/include/dux/algo.d/cpy.hh
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::cpy(T const * const _begin,T const * const _end,T * const _out) noexcept -> void {
- ::dux::cpyn(_begin,static_cast<::dux::usz>(_end - _begin),_out);
-}
diff --git a/include/dux/algo.d/fill.hh b/include/dux/algo.d/fill.hh
deleted file mode 100644
index d0a76b9..0000000
--- a/include/dux/algo.d/fill.hh
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T,typename T0> constexpr auto ::dux::fill(T * const _begin,T * const _end,T0 const _val) noexcept -> void {
- ::dux::filln(_begin,static_cast<::dux::usz>(_end - _begin),_val);
-}
diff --git a/include/dux/algo.d/ins.hh b/include/dux/algo.d/ins.hh
deleted file mode 100644
index 6224951..0000000
--- a/include/dux/algo.d/ins.hh
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::ins(T const * const _begin,T const * const _end,T * const _out) noexcept -> void {
- ::dux::insn(_begin,static_cast<::dux::usz>(_end - _begin),_out);
-}
diff --git a/include/dux/algo.d/insn.hh b/include/dux/algo.d/insn.hh
deleted file mode 100644
index 59392d1..0000000
--- a/include/dux/algo.d/insn.hh
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::insn(T const * const _in,::dux::usz const _num,T * const _out) noexcept -> void {
- ::dux::cpy(_out,_out + _num,_out + _num);
- ::dux::cpy(_in,_in + _num,_out);
-}
diff --git a/include/dux/algo.d/isprime.hh b/include/dux/algo.d/isprime.hh
deleted file mode 100644
index a397f58..0000000
--- a/include/dux/algo.d/isprime.hh
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<::dux::arith T> constexpr auto ::dux::isprime(T const _val) noexcept -> bool {
- if (_val <= T{0x1}) [[unlikely]] {
- return false;
- }
- for (T iter = T{0x2};iter < _val / T{0x2} + T{0x1};iter += T{0x1}) {
- if (_val % iter == T{0x0}) [[unlikely]] {
- return false;
- }
- }
- return true;
-}
diff --git a/include/dux/algo.d/min.hh b/include/dux/algo.d/min.hh
deleted file mode 100644
index 67fc52d..0000000
--- a/include/dux/algo.d/min.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::min(T const & _lval,T const & _rval) noexcept -> T const & {
- if (_lval < _rval) {
- return _lval;
- }
- return _rval;
-}
diff --git a/include/dux/algo.d/mv.hh b/include/dux/algo.d/mv.hh
deleted file mode 100644
index 29fc766..0000000
--- a/include/dux/algo.d/mv.hh
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::mv(T * const _begin,T * const _end,T * const _out) noexcept -> void {
- ::dux::mvn(_begin,static_cast<::dux::usz>(_end - _begin),_out);
-}
diff --git a/include/dux/algo.d/mvn.hh b/include/dux/algo.d/mvn.hh
deleted file mode 100644
index 82a1753..0000000
--- a/include/dux/algo.d/mvn.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::mvn(T * const _in,::dux::usz const _num,T * const _out) noexcept -> void {
- for (auto pos = 0x0uz;pos < _num;pos += 0x1uz) {
- _out[pos] = _in[pos];
- _in[pos] = T{};
- }
-}
diff --git a/include/dux/algo.d/pow.hh b/include/dux/algo.d/pow.hh
deleted file mode 100644
index 58370b0..0000000
--- a/include/dux/algo.d/pow.hh
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<::dux::arith T> constexpr auto ::dux::pow(T const _base,T const _exp) noexcept -> T {
- //if constexpr (::std::is_floating_point_v<T>) {
- //}
- //else {
- if (::dux::abs(_base) <= T{0x1}) [[unlikely]] {
- return _base;
- }
- T res = _base;
- for (T iter = T{0x1};iter < _exp;iter += T{0x1}) {
- res *= _base;
- }
- return res;
- //}
-}
diff --git a/include/dux/algo.d/sqrt.hh b/include/dux/algo.d/sqrt.hh
deleted file mode 100644
index 418d2c6..0000000
--- a/include/dux/algo.d/sqrt.hh
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <limits> /* ::std::numeric_limits */
-
-template<::dux::arith T> constexpr auto ::dux::sqrt(T const _val) noexcept -> T {
- if (_val < T{0x0}) [[unlikely]] {
- return ::std::numeric_limits<T>::quiet_NaN();
- }
- if (_val == T{0x0}) [[unlikely]] {
- return _val;
- }
- /*constexpr auto err = []() {
- if constexpr(::std::is_integral_v<T>) {
- return T{0x1};
- }
- return ::std::numeric_limits<T>::epsilon();
- }();*/
- return _val;
-}
diff --git a/include/dux/algo.hh b/include/dux/algo.hh
deleted file mode 100644
index b11f9a4..0000000
--- a/include/dux/algo.hh
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- template<::dux::arith T> [[dux_attr_const, nodiscard]] constexpr auto abs( T val) noexcept -> T;
- template<typename T> [[dux_attr_hot]] constexpr auto cpy( T const * begin,T const * end, T * out) noexcept -> void;
- template<typename T> [[dux_attr_hot]] constexpr auto cpyn( T const * in, ::dux::usz num, T * out) noexcept -> void;
- template<typename T,typename T0> [[dux_attr_hot]] constexpr auto fill( T * begin,T * end, T0 val) noexcept -> void;
- template<typename T,typename T0> [[dux_attr_hot]] constexpr auto filln( T * in, ::dux::usz num, T0 val) noexcept -> void;
- template<::dux::arith T> [[dux_attr_const, nodiscard]] constexpr auto fma( T x, T y, T z) noexcept -> T;
- template<typename T> [[dux_attr_hot]] constexpr auto ins( T const * begin,T const * end, T * out) noexcept -> void;
- template<typename T> [[dux_attr_hot]] constexpr auto insn( T const * om, ::dux::usz num, T * out) noexcept -> void;
- //template<::dux::arith T> [[dux_attr_const]] constexpr auto isinf( T val) noexcept -> bool;
- template<::dux::arith T> [[dux_attr_const]] constexpr auto isnan( T val) noexcept -> bool;
- template<::dux::arith T> [[dux_attr_const]] constexpr auto isprime(T val) noexcept -> bool;
- template<typename T> [[dux_attr_const, nodiscard]] constexpr auto max( T const & lval, T const & rval) noexcept -> T const &;
- template<typename T> [[dux_attr_const, nodiscard]] constexpr auto min( T const & lval, T const & rval) noexcept -> T const &;
- template<typename T> [[dux_attr_hot]] constexpr auto mv( T * begin,T * end, T * out) noexcept -> void;
- template<typename T> [[dux_attr_hot]] constexpr auto mvn( T * in, ::dux::usz num, T * out) noexcept -> void;
- template<::dux::arith T> [[dux_attr_const]] constexpr auto pow( T base, T exp) noexcept -> T;
- template<typename T> [[dux_attr_allocsz(0x3),dux_attr_hot,dux_attr_malloc,dux_attr_nonnull(0x1),nodiscard]] constexpr auto renew( T * ptr, ::dux::usz sz, ::dux::usz newsz) -> T *;
- template<::dux::arith T> [[dux_attr_const]] constexpr auto sqrt( T val) noexcept -> T;
-
- /* Consteval alternatives for mathematical functions: */
- template<::dux::arith T> [[nodiscard]] consteval auto cabs( T _val) noexcept -> T {return ::dux::abs(_val);}
- template<::dux::arith T> [[nodiscard]] consteval auto cfma( T _x, T _y, T _z) noexcept -> T {return ::dux::fma(_x,_y,_z);}
- //template<::dux::arith T> consteval auto cisinf( T _val) noexcept -> bool {return ::dux::isinf(_val);}
- template<::dux::arith T> consteval auto cisnan( T _val) noexcept -> bool {return ::dux::isnan(_val);}
- template<::dux::arith T> consteval auto cisprime(T _val) noexcept -> bool {return ::dux::isprime(_val);}
- template<typename T> [[nodiscard]] consteval auto cmax( T const & _lval, T const & _rval) noexcept -> T const & {return ::dux::max(_lval,_rval);}
- template<typename T> [[nodiscard]] consteval auto cmin( T const & _lval, T const & _rval) noexcept -> T const & {return ::dux::min(_lval,_rval);}
- template<::dux::arith T> [[nodiscard]] consteval auto cpow( T _base, T _exp) noexcept -> T {return ::dux::pow(_base,_exp);}
- template<::dux::arith T> [[nodiscard]] consteval auto csqrt( T _val) noexcept -> T {return ::dux::sqrt(_val);}
-}
-
-#include <dux/algo.d/abs.hh>
-#include <dux/algo.d/cpy.hh>
-#include <dux/algo.d/cpyn.hh>
-#include <dux/algo.d/fill.hh>
-#include <dux/algo.d/filln.hh>
-#include <dux/algo.d/fma.hh>
-#include <dux/algo.d/ins.hh>
-#include <dux/algo.d/insn.hh>
-//#include <dux/algo.d/isinf.hh>
-#include <dux/algo.d/isnan.hh>
-#include <dux/algo.d/isprime.hh>
-#include <dux/algo.d/min.hh>
-#include <dux/algo.d/mv.hh>
-#include <dux/algo.d/mvn.hh>
-#include <dux/algo.d/pow.hh>
-#include <dux/algo.d/renew.hh>
-#include <dux/algo.d/sqrt.hh>
diff --git a/include/dux/arr.d/arr.hh b/include/dux/arr.d/arr.hh
deleted file mode 100644
index 4af5df3..0000000
--- a/include/dux/arr.d/arr.hh
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::arr<T>::alloc(::dux::usz const _num) -> void {
- if (this->isstatic()) [[unlikely]] {
- this->_isstatic = false;
- }
- else {
- ::delete[] this->_ptr;
- }
- if (_num > 0x0uz) [[likely]] {
- this->_ptr = ::new T[_num]();
- }
- this->_sz = _num;
-}
-template<typename T> template<::dux::cnvto<T> T0> constexpr auto ::dux::arr<T>::alloc(::dux::usz const _num,T0 const _val) -> void {
- this->alloc(_num);
- this->fill(this->begin(),this->end(),_val);
-}
-template<typename T> constexpr auto ::dux::arr<T>::app(::dux::arr<T> const & _oth) -> ::dux::arr<T> const & {
- this->realloc(this->sz() + _oth.sz());
- ::dux::cpy(_oth.begin(),_oth.end(),this->begin() + this->sz() - _oth.sz());
- return *this;
-}
-template<typename T> template<::dux::cnvto<T> T0> constexpr auto ::dux::arr<T>::app(T0 const _val) -> ::dux::arr<T> const & {
- this->realloc(this->sz() + 0x1uz);
- (*this)[this->sz() - 0x1uz] = static_cast<T>(_val);
- return *this;
-}
-template<typename T> constexpr ::dux::arr<T>::arr(T const * const _begin,T const * const _end) {
- if constexpr (::dux::dbg) {
- if (_begin == nullptr || _end == nullptr) [[unlikely]] {
- throw ::dux::invalarg("Provided parameter has value of nullptr.");
- }
- }
- this->alloc(static_cast<::dux::usz>(_end - _begin) + 0x1uz);
- ::dux::cpy(_begin,_end,this->begin());
-}
-template<typename T> constexpr ::dux::arr<T>::arr(::dux::usz const _num) {
- this->alloc(_num);
-}
-template<typename T> constexpr ::dux::arr<T>::arr(::dux::arr<T> const & _oth) {
- if (_oth.isstatic()) [[unlikely]] {
- this->_isstatic = true;
- this->_ptr = _oth.begin();
- this->_sz = _oth.sz();
- return;
- }
- this->alloc(_oth.sz());
- this->ins(_oth.begin(),_oth.end(),0x0uz);
-}
-template<typename T> constexpr ::dux::arr<T>::arr(::dux::arr<T> && _oth) {
- this->_isstatic = _oth.isstatic();
- this->_ptr = _oth.begin();
- this->_sz = _oth.sz();
- _oth._ptr = nullptr;
- _oth._sz = 0x0uz;
-}
-template<typename T> template<::dux::usz N> constexpr ::dux::arr<T>::arr(T const (&_arr)[N]) noexcept {
- this->_isstatic = true;
- this->_ptr = _arr;
- this->_sz = N;
-}
-template<typename T> template<::dux::cnvto<T> T0> constexpr ::dux::arr<T>::arr(::dux::usz const _num,T0 const _val) {
- this->alloc(_num,_val);
-}
-template<typename T> constexpr auto ::dux::arr<T>::begin() noexcept -> T * {
- return this->_ptr;
-}
-template<typename T> constexpr auto ::dux::arr<T>::begin() const noexcept -> T const * {
- return this->_ptr;
-}
-template<typename T> constexpr auto ::dux::arr<T>::cbegin() const noexcept -> T const * {
- return this->begin();
-}
-template<typename T> constexpr auto ::dux::arr<T>::cend() const noexcept -> T const * {
- return this->begin() + this->sz;
-}
-template<typename T> constexpr auto ::dux::arr<T>::del(::dux::usz const _pos) -> void {
- if constexpr (::dux::dbg) {
- if (_pos >= this->sz()) [[unlikely]] {
- throw ::dux::outofdomain("Position out of bounds!");
- }
- }
- if (this->sz() <= 0x1uz) [[unlikely]] {
- if (this->sz() == 0x0uz) {
- this->alloc(0x0uz);
- return;
- }
- return;
- }
- ::dux::cpy(this->begin() + _pos + 0x1uz,this->end(),this->begin() + _pos);
- this->realloc(this->sz() - 0x1uz);
-}
-template<typename T> constexpr auto ::dux::arr<T>::end() noexcept -> T * {
- return this->begin() + this->sz();
-}
-template<typename T> constexpr auto ::dux::arr<T>::end() const noexcept -> T const * {
- return this->begin() + this->sz();
-}
-template<typename T> template<::dux::cnvto<T> T0> constexpr auto ::dux::arr<T>::fill(T0 const _val) -> void {
- this->fill(this->begin(),this->end(),_val);
-}
-template<typename T> template<::dux::cnvto<T> T0> constexpr auto ::dux::arr<T>::fill(T * const dux_restr _begin,T * const dux_restr _end,T0 const _val) -> void {
- if (this->sz() == 0x0uz) [[unlikely]] {
- return; /* slime incident */
- }
- if constexpr (::dux::dbg) {
- if (_begin < this->begin() || _end > this->end()) [[unlikely]] {
- throw ::dux::outofdomain("Beginning or end are out of this array's range.");
- }
- }
- if (this->isstatic()) [[unlikely]] {
- this->alloc(static_cast<::dux::usz>(_end - _begin) + 0x1uz);
- }
- ::dux::fill(this->begin(),this->end(),_val);
-}
-template<typename T> constexpr auto ::dux::arr<T>::ins(T const * const _begin,T const * const _end,::dux::usz const _pos) -> ::dux::arr<T> const & {
- this->realloc(this->sz() + static_cast<::dux::usz>(_end - _begin) + 0x1uz);
- ::dux::ins(_begin,_end,this->begin() + _pos);
- return *this;
-}
-template<typename T> constexpr auto ::dux::arr<T>::ins(::dux::arr<T> const & _oth,::dux::usz const _pos) -> ::dux::arr<T> const & {
- return this->ins(_oth.begin(),_oth.end(),_pos);
-}
-template<typename T> constexpr auto ::dux::arr<T>::isstatic() const noexcept -> bool {
- return this->_isstatic;
-}
-template<typename T> constexpr auto ::dux::arr<T>::operator = (::dux::arr<T> const & _oth) -> ::dux::arr<T> const & {
- this->~arr();
- if (_oth.isstatic()) [[unlikely]] {
- this->_isstatic = true;
- this->_ptr = const_cast<T *>(_oth.begin());
- this->_sz = _oth.sz();
- }
- else {
- this->alloc(_oth.sz());
- this->ins(_oth.begin(),_oth.end(),0x0uz);
- }
- return *this;
-}
-template<typename T> constexpr auto ::dux::arr<T>::operator [] (::dux::usz const _pos) -> T & {
- if constexpr (::dux::dbg) {
- if (_pos >= this->sz()) [[unlikely]] {
- throw ::dux::invalarg("Input parameter is out of range.");
- }
- }
- return this->begin()[_pos];
-}
-template<typename T> constexpr auto ::dux::arr<T>::operator [] (::dux::usz const _pos) const -> T const & {
- if constexpr (::dux::dbg) {
- if (_pos >= this->sz()) [[unlikely]] {
- throw ::dux::invalarg("Input parameter is out of range.");
- }
- }
- return this->begin()[_pos];
-}
-template<typename T> constexpr auto ::dux::arr<T>::realloc(::dux::usz const _num) -> void {
- if (this->sz() == 0x0uz) [[unlikely]] {
- return this->alloc(_num);
- }
- if (this->isstatic()) [[unlikely]] {
- this->_isstatic = false;
- }
- this->_ptr = ::dux::renew(this->begin(),this->sz(),_num);
- this->_sz = _num;
-}
-template<typename T> constexpr auto ::dux::arr<T>::setraw(T const * const dux_restr _ptr,::dux::usz const _sz) noexcept -> void {
- if (!this->isstatic()) [[unlikely]] {
- ::delete[] this->_ptr;
- }
- this->_ptr = const_cast<T *>(_ptr);
- this->_sz = _sz;
-}
-template<typename T> constexpr auto ::dux::arr<T>::sub(::dux::usz const _pos,::dux::usz const _sz) const -> ::dux::arr<T> {
- auto const sz = [&]() {
- if (_sz == 0x0uz) {
- return this->sz() - _sz;
- }
- return _sz;
- }();
- ::dux::arr<T> arr;
- if (this->isstatic()) [[unlikely]] {
- arr._sz = sz;
- arr._ptr = const_cast<T *>(this->begin()) + _pos;
- }
- else {
- arr.alloc(sz);
- ::dux::cpyn(this->begin(),sz,arr.begin());
- }
- return arr;
-}
-template<typename T> constexpr auto ::dux::arr<T>::sz() const noexcept -> ::dux::usz {
- return this->_sz;
-}
-template<typename T> constexpr ::dux::arr<T>::~arr<T>() noexcept {
- if (this->isstatic()) {
- return;
- }
- ::delete[] this->_ptr;
-}
diff --git a/include/dux/arr.hh b/include/dux/arr.hh
deleted file mode 100644
index 10822c2..0000000
--- a/include/dux/arr.hh
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- template<typename T> class arr {
- public:
- constexpr auto alloc( ::dux::usz num) -> void;
- template<::dux::cnvto<T> T0> constexpr auto alloc( ::dux::usz num, T0 val) -> void;
- constexpr auto app( ::dux::arr<T> const & oth) -> ::dux::arr<T> const &;
- template<::dux::cnvto<T> T0> constexpr auto app( T0 val) -> ::dux::arr<T> const &;
- [[nodiscard]] constexpr arr() noexcept = default;
- [[nodiscard]] constexpr arr( T const * begin, T const * end);
- [[nodiscard]] constexpr arr( ::dux::usz num);
- [[nodiscard]] constexpr arr( ::dux::arr<T> const & oth);
- [[nodiscard]] constexpr arr( ::dux::arr<T> && oth);
- template<::dux::usz N> [[nodiscard]] constexpr arr( T const (& arr)[N]) noexcept;
- template<::dux::cnvto<T> T0> [[nodiscard]] constexpr arr( ::dux::usz num, T0 val);
- [[nodiscard]] constexpr auto begin() noexcept -> T *;
- [[nodiscard]] constexpr auto begin() const noexcept -> T const *;
- [[nodiscard]] constexpr auto cbegin() const noexcept -> T const *;
- [[nodiscard]] constexpr auto cend() const noexcept -> T const *;
- constexpr auto del( ::dux::usz pos) -> void;
- [[nodiscard]] constexpr auto end() noexcept -> T *;
- [[nodiscard]] constexpr auto end() const noexcept -> T const *;
- template<::dux::cnvto<T> T0> constexpr auto fill( T0 val) -> void;
- template<::dux::cnvto<T> T0> constexpr auto fill( T * begin, T * end,T0 val) -> void;
- constexpr auto ins( ::dux::arr<T> const & oth, ::dux::usz pos) -> ::dux::arr<T> const &;
- constexpr auto ins( T const * begin, T const * end,::dux::usz pos) -> ::dux::arr<T> const &;
- [[nodiscard]] constexpr auto isstatic() const noexcept -> bool;
- constexpr auto operator = ( ::dux::arr<T> const & oth) -> ::dux::arr<T> const &;
- [[nodiscard]] constexpr auto operator [] (::dux::usz pos) -> T &;
- [[nodiscard]] constexpr auto operator [] (::dux::usz pos) const -> T const &;
- constexpr auto realloc( ::dux::usz num) -> void;
- constexpr auto setraw( T const * ptr, ::dux::usz sz) noexcept -> void;
- [[nodiscard]] constexpr auto sub( ::dux::usz pos, ::dux::usz sz) const -> ::dux::arr<T>;
- [[nodiscard]] constexpr auto sz() const noexcept -> ::dux::usz;
- constexpr ~arr() noexcept;
- private:
- bool _isstatic{false};
- T * _ptr {nullptr};
- ::dux::usz _sz {0x0uz};
- };
-}
-
-#include <dux/arr.d/arr.hh>
diff --git a/include/dux/base.d/opt.hh b/include/dux/base.d/opt.hh
deleted file mode 100644
index e779233..0000000
--- a/include/dux/base.d/opt.hh
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<typename T> constexpr auto ::dux::opt<T>::operator * () const -> T const & {
- if (!*this) [[unlikely]] {
- throw ::dux::badoptacs();
- }
- return this->_val;
-}
-template<typename T> constexpr auto ::dux::opt<T>::operator -> () const -> T const * {
- if (!*this) [[unlikely]] {
- throw ::dux::badoptacs();
- }
- return &**this;
-}
-template<typename T> constexpr auto ::dux::opt<T>::operator = (::dux::opt<T> const & _oth) -> ::dux::opt<T> const & {
- if (!_oth) {
- this->reset();
- return *this;
- }
- this->_has = true;
- this->_val = *_oth;
- return *this;
-}
-template<typename T> constexpr ::dux::opt<T>::opt(T const & _val) noexcept {
- this->_has = true;
- this->_val = _val;
-}
-template<typename T> constexpr ::dux::opt<T>::opt(::dux::opt<T> const & _oth) noexcept {
- this->operator = (_oth);
-}
-template<typename T> constexpr auto ::dux::opt<T>::set(T const & _val) noexcept {
- this->_val = _val;
- this->_has = true;
-}
-template<typename T> constexpr auto ::dux::opt<T>::reset() noexcept -> void {
- this->_has = false;
- ::new (&this->_val) T; /* Placement new: used for "uninitialising" a variable (I think). */
-}
diff --git a/include/dux/base.d/tup.hh b/include/dux/base.d/tup.hh
deleted file mode 100644
index 432ff9c..0000000
--- a/include/dux/base.d/tup.hh
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- template<typename Fn,typename... Ts,::dux::usz... N> [[nodiscard]] constexpr auto _tupapply(Fn && fn,::dux::tup<Ts...> const & tup,::dux::intseq<::dux::usz,N...>) -> decltype(auto);
-}
-
-template<typename Fn,typename... Ts,::dux::usz... N> [[nodiscard]] constexpr auto ::dux::_tupapply(Fn && _fn,::dux::tup<Ts...> const & _tup,::dux::intseq<::dux::usz,N...>) -> decltype(auto) {
- return _fn(_tup.template get<N>()...);
-}
-template<typename T,typename... Ts> template<typename Fn> constexpr auto ::dux::tup<T,Ts...>::apply(Fn const & _fn) const -> decltype(auto) {
- return ::dux::_tupapply(_fn,*this,dux::mkintseq<::dux::usz,0x1uz + sizeof...(Ts)>{});
-}
-template<typename T,typename... Ts> template<::dux::usz N> constexpr auto ::dux::tup<T,Ts...>::get() const noexcept -> auto {
- return static_cast<::dux::_tupbase<N,typename ::dux::_tupgettyp<N,T,Ts...>::typ> const *>(this)->get();
-}
-template<typename T,typename... Ts> template<typename T0,typename... Ts0> constexpr auto ::dux::tup<T,Ts...>::operator == (::dux::tup<T0,Ts0...> const & _oth) noexcept -> bool {
- if constexpr (!::dux::issame<decltype(*this),decltype(_oth)>) {
- return false;
- }
- else {
- constexpr auto num{sizeof...(Ts)};
- if constexpr (num == 0x0uz) {
- return true;
- }
- }
-}
diff --git a/include/dux/base.hh b/include/dux/base.hh
deleted file mode 100644
index 32e4060..0000000
--- a/include/dux/base.hh
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-/*
- base > algo ─>┬> arr ─>┬> str > sys >┬> io
- └> cstr >┘ ├> media
- └> thrd
-*/
-
-#if defined(__clang__)
-#define dux_cmp_clang
-#endif
-#if defined(__INTEL_COMPILER)
-#define dux_cmp_icc
-#endif
-#if defined(_MSC_VER)
-#define dux_cmp_msvc
-#endif
-#if defined(__GNUG__) && (!defined(dux_cmp_clang) || !defined(dux_cmp_icc))
-#define dux_cmp_gcc
-#endif
-
-#if defined(__TOS_AIX__) || defined(_AIX)
-#define dux_os_aix
-#endif
-#if defined(__amigaos__)
-#define dux_os_amigaos
-#endif
-#if defined(__ANDROID__)
-#define dux_os_android
-#endif
-#if defined(__THW_BLUEGENE__) || defined(__TOS_BGQ__) || defined(__bg__) || defined(__bgq__)
-#define dux_os_bluegene
-#endif
-#if defined(__DragonFly__)
-#define dux_os_dragonflybsd
-#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#define dux_os_freebsd
-#endif
-#if defined(__BEOS__)
-#define dux_os_haiku
-#endif
-#if defined(__hpux) || defined(_hpux)
-#define dux_os_hpux
-#endif
-#if defined(__GNU__) || defined(__gnu_hurd__)
-#define dux_os_hurd
-#endif
-#if defined(__OS400__) || defined(__OS400_TGTVRM__)
-#define dux_os_ibmi
-#endif
-#if defined(__INTEGRITY)
-#define dux_os_integrity
-#endif
-#if defined(__APPLE__) || defined(__MACH__)
-#define dux_os_mac
-#endif
-#if defined(__minix)
-#define dux_os_minix
-#endif
-#if defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS)
-#define dux_os_msdos
-#endif
-#if defined(__NetBSD__)
-#define dux_os_netbsd
-#endif
-#if defined(__OpenBSD__)
-#define dux_os_openbsd
-#endif
-#if defined(__OS2__) || defined(__TOS_OS2__) || defined(_OS2)
-#define dux_os_os2
-#endif
-#if defined(__sun)
-#define dux_os_solaris
-#endif
-#if defined(__TOS_WIN__) || defined(__WIN32__) || defined(__WINDOWS__) || defined(_WIN16) || defined(_WIN32) || defined(_WIN32_CE) || defined(_WIN64)
-#define dux_os_win
-#endif
-#if defined(__HOS_MVS__) || defined(__MVS__) || defined(__TOS_MVS__)
-#define dux_os_zos
-#endif
-#if defined(_SYSTYPE_BSD) || defined(dux_os_dragonflybsd) || defined(dux_os_freebsd) || defined(dux_os_netbsd) || defined(dux_os_openbsd)
-#define dux_os_bsd
-#elif __has_include(<sys/param.h>)
-#include <sys/param.h>
-#if defined(BSD)
-#define dux_os_bsd
-#endif
-#endif
-#if defined(__linux__) || defined(dux_os_android)
-#define dux_os_linux
-#endif
-#if defined(__unix) || defined(__unix__) || defined(dux_os_aix) || defined(dux_os_android)|| defined(dux_os_bsd) || defined(dux_os_hpux) || defined(dux_os_hurd) || defined(dux_os_linux) || defined(dux_os_mac) || defined(dux_os_minix) || defined(dux_os_solaris)
-#define dux_os_posix
-#elif __has_include(<unistd.h>)
-#include <unistd.h>
-#if defined(_POSIX_VERSION)
-#define dux_os_posix
-#endif
-#endif
-
-#include <exception> /* This is the one STDLIB dependency which we cannot get rid of. By making our exception class ((::dux::except)) inherit from (::std::exception), we can get the exception message to be displayed on terminate. Luckily, this header is (in theory) small. */
-
-#if defined(__has_builtin)
-#define dux_hasbuiltin(builtin) __has_builtin(builtin)
-#else
-#define dux_hasbuiltin(builtin) false
-#endif
-
-#if defined(dux_os_posix) /* POSIX requires the size of bytes (in bits) to be exactly 8. We can use this knowledge to decrease our STDLIB dependencies. */
-#define dux_bytesz 0x8u
-#elif defined(dux_cmp_clang) || defined(dux_cmp_gcc) /* Nice! Clang and GCC define the (__CHAR_BIT) macro. */
-#define dux_bytesz __CHAR_BIT
-#else /* :( */
-#include <climits> /* CHAR_BIT */
-#define dux_bytesz CHAR_BIT
-#endif
-
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
-#define dux_intmax __INT_MAX__
-#define dux_llongmax __LONG_LONG_MAX__
-#define dux_longmax __LONG_MAX__
-#define dux_shrtmax __SHRT_MAX__
-#else
-#include <climits>
-#define dux_intmax INT_MAX
-#define dux_llongmax LLONG_MAX
-#define dux_longmax LONG_MAX
-#define dux_shrtmax SHRT_MAX
-#endif
-
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc) || defined(dux_cmp_icc)
-#define dux_attr_abitag( ...) gnu::abi_tag(__VA_ARGS__)
-#define dux_attr_allocsz( ...) gnu::alloc_size(__VA_ARGS__)
-#define dux_attr_artif gnu::artificial
-#define dux_attr_cold gnu::cold
-#define dux_attr_const gnu::const
-#define dux_attr_fmt gnu::format
-#define dux_attr_malloc gnu::malloc
-#define dux_attr_nonnull( ...) gnu::nonnull(__VA_ARGS__)
-#define dux_attr_hot gnu::hot
-#define dux_attr_inline gnu::always_inline
-#define dux_attr_pure gnu::pure
-#define dux_attr_retnonnull gnu::returns_nonnull
-#define dux_attr_sect( ...) gnu::section(__VA_ARGS__)
-#else
-#define dux_attr_abitag( ...)
-#define dux_attr_allocsz( ...)
-#define dux_attr_artif
-#define dux_attr_cold
-#define dux_attr_const
-#define dux_attr_fmt
-#define dux_attr_hot
-#define dux_attr_inline
-#define dux_attr_malloc
-#define dux_attr_nonnull( ...)
-#define dux_attr_pure
-#define dux_attr_retnonnull
-#define dux_attr_sect( ...)
-#endif
-#if defined(dux_cmp_clang)
-#define dux_attr_noderef clang::noderef
-#define dux_attr_noesc( ...) clang::noescape(__VA_ARGS__)
-#else
-#define dux_attr_noderef
-#define dux_attr_noesc( ...)
-#endif
-
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc) || defined(dux_cmp_icc)
-#define dux_fnnm __PRETTY_FUNCTION__
-#elif defined(dux_cmp_msvc)
-#define dux_fnnm __FUNCSIG__
-#else
-#define dux_fnnm __func__
-#endif
-
-
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
-#define dux_restr __restrict__
-#elif defined(dux_cmp_icc) || defined(dux_cmp_msvc)
-#define dux_restr __restrict
-#else
-#define dux_restr
-#endif
-
-namespace dux {
- using ubyte = unsigned char;
- using sbyte = signed char;
- template<typename T> consteval auto ubytev(T const & _val) noexcept {return static_cast<::dux::ubyte>(_val);}
- template<typename T> consteval auto sbytev(T const & _val) noexcept {return static_cast<::dux::sbyte>(static_cast<::dux::ubyte>(_val));} /* We cast to the unsigned equivalent type first to avoid undefined behavoir, which will stop compilation, as we are in an immediate function. */
-
- constexpr auto bytesz{static_cast<::dux::ubyte>(dux_bytesz)};
-
- template<typename T,typename T0> struct _issame {constexpr static auto issame{false};};
- template<typename T> struct _issame<T,T> {constexpr static auto issame{true};};
- template<typename T,typename T0> constexpr auto issame{::dux::_issame<T,T0>::issame};
-
- template<typename T> struct _remconst {using t = T;};
- template<typename T> struct _remconst<T const> {using t = T;};
- template<typename T> using remconst = typename ::dux::_remconst<T>::t;
-
- template<typename T> struct _remrestr {using t = T;};
- template<typename T> struct _remrestr<T * dux_restr> {using t = T *;};
- template<typename T> using remrestr = typename ::dux::_remrestr<T>::t;
-
- template<typename T> struct _remvolat {using t = T;};
- template<typename T> struct _remvolat<T volatile> {using t = T;};
- template<typename T> using remvolat = typename ::dux::_remvolat<T>::t;
-
- template<typename T> using remcr = typename ::dux::remrestr<::dux::remconst<T>>;
- template<typename T> using remcrv = typename ::dux::remrestr<::dux::remvolat<::dux::remconst<T>>>;
- template<typename T> using remcv = typename ::dux::remvolat<::dux::remconst<T>>;
- template<typename T> using remvr = typename ::dux::remrestr<::dux::remvolat<T>>;
-
- using _flt128 =
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
- __float128;
-#else
- long double;
-#endif
- using _uint128 =
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
- unsigned __int128;
-#else
- unsigned long long;
-#endif
- using _sint128 =
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
- __int128;
-#else
- long long;
-#endif
-
- template<typename T,typename T0> constexpr auto iscnvto = requires {static_cast<T>(T0{});};
- template<typename T,typename T0> concept cnvto = ::dux::iscnvto<T,T0>;
- template<typename T> constexpr auto issint = ::dux::issame<T,::dux::_sint128> || ::dux::issame<T,int> || ::dux::issame<T,long> || ::dux::issame<T,long long> || ::dux::issame<T,short> || ::dux::issame<T,signed char>;
- template<typename T> concept sint = ::dux::issint<T>;
- template<typename T> constexpr auto isuint = ::dux::issame<T,::dux::_uint128> || ::dux::issame<T,unsigned> || ::dux::issame<T,unsigned char> || ::dux::issame<T,unsigned long> || ::dux::issame<T,unsigned long long> || ::dux::issame<T,unsigned short>;
- template<typename T> concept uint = ::dux::isuint<T>;
- template<typename T> constexpr auto ischr = ::dux::issame<T,char> || ::dux::issame<T,char16_t> || ::dux::issame<T,char32_t> || ::dux::issame<T,char8_t> || ::dux::issame<T,wchar_t>;
- template<typename T> concept chr = ::dux::ischr<T>;
- template<typename T> constexpr auto isflt = ::dux::issame<T,::dux::_flt128> || ::dux::issame<T,double> || ::dux::issame<T,float> || ::dux::issame<T,long double>;
- template<typename T> concept flt = ::dux::isflt<T>;
- template<typename T> constexpr auto isnullptrtyp = ::dux::issame<T,decltype(nullptr)>;
- template<typename T> constexpr auto isutf = ::dux::issame<T,char16_t> || ::dux::issame<T,char32_t> || ::dux::issame<T,char8_t>;
- template<typename T> concept utf = ::dux::isutf<T>;
- template<typename T> constexpr auto isvoid = ::dux::issame<T,void>;
- template<typename T> concept void_ = ::dux::isvoid<T>;
-
- template<typename T> struct _isptr {constexpr static auto isptr{false};};
- template<typename T> struct _isptr<T *> {constexpr static auto isptr{true};};
- template<typename T> constexpr auto isptr = ::dux::_isptr<T>::isptr;
-
- template<typename T> constexpr auto isint = ::dux::issame<T,char> || ::dux::issint<T> || ::dux::isuint<T>;
- template<typename T> concept int_ = ::dux::isint<T>;
-
- template<typename T> constexpr auto isarith = ::dux::isflt<T> || ::dux::isint<T>;
- template<typename T> concept arith = ::dux::isarith<T>;
-
- template<typename T> struct _sign {using t = T;};
- template<> struct _sign<char> {using t = signed char;};
- template<> struct _sign<unsigned> {using t = int;};
- template<> struct _sign<unsigned char> {using t = signed char;};
- template<> struct _sign<unsigned long> {using t = long;};
- template<> struct _sign<unsigned long long> {using t = long long;};
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
- template<> struct _sign<unsigned __int128> {using t = __int128;};
-#endif
- template<::dux::int_ T> using sign = typename ::dux::_sign<T>::t;
-
- template<typename T> struct _unsign {using t = T;};
- template<> struct _unsign<char> {using t = unsigned char;};
- template<> struct _unsign<int> {using t = unsigned;};
- template<> struct _unsign<long> {using t = unsigned long;};
- template<> struct _unsign<long long> {using t = unsigned long long;};
- template<> struct _unsign<signed char> {using t = unsigned char;};
-#if defined(dux_cmp_clang) || defined(dux_cmp_gcc)
- template<> struct _unsign<__int128> {using t = unsigned __int128;};
-#endif
- template<::dux::int_ T> using unsign = typename ::dux::_unsign<T>::t;
-
- using uint16 =
-#if dux_bytesz >= 0x10u
- unsigned char;
-#else
- unsigned short;
-#endif
- using uint32 =
-#if dux_bytesz >= 0x20u
- unsigned char;
-#elif dux_shrtmax >= 0x7FFFFFFFu
- unsigned short;
-#elif dux_intmax >= 0x7FFFFFFFu
- unsigned int;
-#else
- unsigned long;
-#endif
- using uint64 =
-#if dux_bytesz >= 0x40u
- unsigned char;
-#elif dux_shrtmax >= 0x7FFFFFFFFFFFFFFFu
- unsigned short;
-#elif dux_intmax >= 0x7FFFFFFFFFFFFFFFu
- unsigned int;
-#elif dux_longmax >= 0x7FFFFFFFFFFFFFFFu
- unsigned long;
-#else
- unsigned long long;
-#endif
- using sint16 = ::dux::sign<::dux::uint16>;
- using sint32 = ::dux::sign<::dux::uint32>;
- using sint64 = ::dux::sign<::dux::uint64>;
- template<typename T> consteval auto uint16v(T const & _val) noexcept {return static_cast<::dux::uint16>(_val);}
- template<typename T> consteval auto sint16v(T const & _val) noexcept {return static_cast<::dux::sint16>(static_cast<::dux::uint16>(_val));}
- template<typename T> consteval auto uint32v(T const & _val) noexcept {return static_cast<::dux::uint32>(_val);}
- template<typename T> consteval auto sint32v(T const & _val) noexcept {return static_cast<::dux::sint32>(static_cast<::dux::uint32>(_val));}
- template<typename T> consteval auto uint64v(T const & _val) noexcept {return static_cast<::dux::uint64>(_val);}
- template<typename T> consteval auto sint64v(T const & _val) noexcept {return static_cast<::dux::sint64>(static_cast<::dux::uint64>(_val));}
-
- using usz = decltype(0x0uz);
- using ssz = decltype(0x0z);
-
- using nullptrtyp = decltype(nullptr);
-
- enum class endi : bool {
- big = true,
- little = false,
- };
-
- enum class stat : ::dux::ubyte {
- err = ::dux::ubytev(0x1),
- ok = ::dux::ubytev(0x0),
- };
-
- class except : public ::std::exception {
- public:
- [[nodiscard]] except() noexcept : _what("") {}
- [[nodiscard]] except(char const * _what) noexcept : _what(_what) {}
- virtual auto what() const noexcept -> char const * {return this->_what;}
- private:
- char const * const dux_restr _what;
- };
- class badalloc : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class badio : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class badoptacs : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class invalarg : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class invalutf : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class outofdomain : public ::dux::except {
- public:
- using ::dux::except::except;
- };
- class runerr : public ::dux::except {
- public:
- using ::dux::except::except;
- };
-
- template<::dux::int_ T,T... Ints> class intseq {
- public:
- constexpr static auto sz{0x1uz + sizeof...(Ints)};
- };
- template<::dux::int_ T,T N> using mkintseq =
-#if dux_hasbuiltin(__make_integer_seq) /* Clang has this builtin for this exact purpose. */
- __make_integer_seq<::dux::intseq,T,N>;
-#elif dux_hasbuiltin(__integer_pack)
- ::dux::intseq<__integer_pack(N)...>;
-#else
- ::dux::intseq<T,N>;
-_Pragma("message \"Cannot implement (::dux::mkintseq)!\"");
-#endif
-
- template<typename T> class opt {
- public:
- [[nodiscard]] constexpr auto operator * () const -> T const &;
- [[nodiscard]] constexpr auto operator -> () const -> T const *;
- constexpr auto operator = ( ::dux::opt<T> const & oth) -> ::dux::opt<T> const &;
- [[nodiscard]] constexpr explicit operator bool () const noexcept {return this->_has;}
- [[nodiscard]] constexpr opt() noexcept = default;
- [[nodiscard]] constexpr opt( T const & val) noexcept;
- [[nodiscard]] constexpr opt( ::dux::opt<T> const & oth) noexcept;
- constexpr auto set( T const & val) noexcept;
- constexpr auto reset() noexcept -> void;
- private:
- bool _has{false};
- T _val;
- };
-
- template<::dux::usz N,typename T> class _tupbase {
- public:
- [[nodiscard]] constexpr _tupbase() noexcept = default;
- [[nodiscard]] constexpr _tupbase(T const & _val) noexcept {this->_val = _val;}
- [[nodiscard]] constexpr auto get() const noexcept -> T const & {return this->_val;}
- private:
- T _val;
- };
- template<::dux::usz N, typename... Ts> class _tuprecurbase {};
- template<::dux::usz N, typename T, typename... Ts> class _tuprecurbase<N,T,Ts...> : public ::dux::_tupbase<N,T>,public ::dux::_tuprecurbase<N + 0x1uz,Ts...> {
- public:
- [[nodiscard]] constexpr _tuprecurbase() noexcept = default;
- template<typename T0,typename... Ts0> [[nodiscard]] constexpr _tuprecurbase(T0 const & _val,Ts0 const &... _vals) noexcept : ::dux::_tupbase<N,T0>(_val), ::dux::_tuprecurbase<N + 0x1uz,Ts...>(_vals...) {};
- };
- template<::dux::usz N,typename T,typename... Ts> class _tupgettyp {
- public:
- using typ = typename ::dux::_tupgettyp<N - 0x1uz,Ts...>::typ;
- };
- template<typename T,typename... Ts> class _tupgettyp<0x0uz,T,Ts...> {
- public:
- using typ = T;
- };
- template<typename T, typename... Ts> class tup : public ::dux::_tuprecurbase<0x0uz,T,Ts...> {
- public:
- template<typename Fn> [[nodiscard]] constexpr auto apply( Fn const & fn) const -> decltype(auto);
- template<::dux::usz N> [[nodiscard]] constexpr auto get() const noexcept -> auto;
- template<typename T0, typename... Ts0> [[nodiscard]] constexpr auto operator == (::dux::tup<T0,Ts0...> const & oth) noexcept -> bool;
- [[nodiscard]] constexpr tup() noexcept = default;
- [[nodiscard]] constexpr tup( T const & _val,Ts const &... _vals) noexcept : ::dux::_tuprecurbase<0x0uz,T,Ts...>(_val,_vals...) {}
-
- constexpr static auto sz{0x1uz + sizeof...(Ts)};
- };
-
- constexpr auto dbg{[]() {
-#if defined(NDEBUG)
- return false;
-#else
- return true;
-#endif
- }()};
- constexpr auto lorem {U"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."};
- constexpr auto npos {-0x1uz};
- constexpr auto unimax{U'\U00010FFF'};
- constexpr auto ver {::dux::uint64v(0x1D)};
-}
-
-#include <dux/base.d/opt.hh>
-#include <dux/base.d/tup.hh>
diff --git a/include/dux/cstr.d/cstrcmp.hh b/include/dux/cstr.d/cstrcmp.hh
deleted file mode 100644
index ad262dc..0000000
--- a/include/dux/cstr.d/cstrcmp.hh
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::cstrcmp(char const * const dux_restr _lstr,char const * const dux_restr _rstr) noexcept -> ::dux::sbyte {
- auto const maxn = ::dux::min(::dux::cstrlen(_lstr),::dux::cstrlen(_rstr));
- for (auto n = 0x0uz;n <= maxn;n += 0x1uz) {
- auto const lchr = _lstr[n];
- auto const rchr = _rstr[n];
- if (lchr != rchr) [[unlikely]] {
- if (lchr > rchr) {
- return ::dux::sbytev(-0x1);
- }
- if (lchr < rchr) {
- return ::dux::sbytev(0x1);
- }
- }
- }
- return ::dux::sbytev(0x0);
-}
diff --git a/include/dux/cstr.d/cstrcpy.hh b/include/dux/cstr.d/cstrcpy.hh
deleted file mode 100644
index a8e5f65..0000000
--- a/include/dux/cstr.d/cstrcpy.hh
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::cstrcpy(char * const dux_restr _dest,char const * const dux_restr _src) noexcept -> char * {
- auto const sz = ::dux::cstrlen(_src);
- if (sz == 0x0uz) [[unlikely]] {
- return _dest;
- }
- ::dux::cpy(_src,_src + sz - 0x1uz,_dest);
- return _dest;
-}
diff --git a/include/dux/cstr.d/cstrdup.hh b/include/dux/cstr.d/cstrdup.hh
deleted file mode 100644
index 43ecc18..0000000
--- a/include/dux/cstr.d/cstrdup.hh
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::cstrdup(char const * const dux_restr _str1) -> char * {
- auto const sz = ::dux::cstrlen(_str1);
- auto * const dux_restr str = ::new char[sz];
- return ::dux::cstrcpy(str,_str1);
-}
diff --git a/include/dux/cstr.d/cstrlen.hh b/include/dux/cstr.d/cstrlen.hh
deleted file mode 100644
index b8c8e58..0000000
--- a/include/dux/cstr.d/cstrlen.hh
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::cstrlen(char const * const dux_restr _str) noexcept -> ::dux::usz {
- auto sz = 0x0uz;
- for (::dux::usz n = 0x0uz;;n += 0x1uz) {
- if (_str[n] == '\u0000') [[unlikely]] {
- break;
- }
- sz += 0x1uz;
- }
- return sz;
-}
diff --git a/include/dux/io.d/fmt.hh b/include/dux/io.d/fmt.hh
deleted file mode 100644
index bf907f7..0000000
--- a/include/dux/io.d/fmt.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::fmt(::dux::str const & _str) -> ::dux::str {
- if (auto const pos = _str.fnd(::dux::fmtchr);pos != ::dux::npos) {
- throw ::dux::fmterr("Format-specifier '$' was found, but no object to be formatted was provided.");
- }
- return _str;
-}
-template<typename T> constexpr auto ::dux::fmt(::dux::str const & _str,T const _fmt) -> ::dux::str {
- auto const pos = _str.fnd(::dux::fmtchr);
- if (pos == ::dux::npos) {
- throw ::dux::fmterr("Object to be formatted provided, but an equivalent format-specifier '$' was not found!");
- }
- auto str = _str;
- str.del(pos);
- str.ins(pos,::dux::fmter(_fmt));
- return str;
-}
-template<typename T,typename... Ts> constexpr auto ::dux::fmt(::dux::str const & _str,T const _fmt,Ts... args) -> ::dux::str {
- auto const pos = _str.fnd(::dux::fmtchr);
- if (pos == ::dux::npos) {
- throw ::dux::fmterr("Object to be formatted provided, but an equivalent format-specifier '$' was not found!");
- }
- auto str = _str;
- str.del(pos);
- str.ins(pos,::dux::fmter(_fmt));
- return str + ::dux::fmt(_str.sub(pos + 0x1uz,0x0uz),args...);
-}
diff --git a/include/dux/io.d/fmter.hh b/include/dux/io.d/fmter.hh
deleted file mode 100644
index ef56ed1..0000000
--- a/include/dux/io.d/fmter.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux::priv {
- template<typename T> constexpr auto intfmter(T const _fmt) -> ::dux::str {
- auto const fmt = [&]() {
- if constexpr(::dux::isptr<T>) {
- return (::dux::uint64)_fmt;
- }
- else {
- return _fmt;
- }
- }();
- using T0 = decltype(fmt);
- if constexpr (::dux::issint<T>) {
- if (fmt < T0{0x0}) {
- return ::dux::str(U'−') + ::dux::fmter(::dux::abs(fmt));
- }
- }
- if (fmt < ::dux::base) {
- auto const nums = []() {
- if (::dux::base == ::dux::ubytev(0xC)) {
- return U"0123456789↊↋";
- }
- return U"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- }();
- return nums[fmt];
- }
- return ::dux::fmter(fmt / T0{::dux::base}) + ::dux::fmter(fmt % T0{::dux::base});
- }
-}
-template<> constexpr auto ::dux::fmter(bool const _fmt) -> ::dux::str {
- if (_fmt) {
- return U"true";
- }
- return U"false";
-}
-/*template<> constexpr auto ::dux::fmter(char16_t const * const dux_restr _fmt) -> ::dux::str {
- return ::dux::str{_fmt};
-}*/
-template<> constexpr auto ::dux::fmter(char32_t const * const dux_restr _fmt) -> ::dux::str {
- return ::dux::str{_fmt};
-}
-template<> constexpr auto ::dux::fmter(char8_t const * const dux_restr _fmt) -> ::dux::str {
- return ::dux::str{_fmt};
-}
-template<> constexpr auto ::dux::fmter(int const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(long const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(long long const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(short const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(::dux::nullptrtyp) -> ::dux::str {
- return U"nullptr";
-}
-template<> constexpr auto ::dux::fmter(::dux::str const _fmt) -> ::dux::str {
- return _fmt;
-}
-template<> constexpr auto ::dux::fmter(unsigned const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(unsigned long const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(unsigned long long const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(unsigned short const _fmt) -> ::dux::str {
- return ::dux::priv::intfmter(_fmt);
-}
-template<> constexpr auto ::dux::fmter(void const * const dux_restr _fmt) -> ::dux::str {
- if (_fmt == nullptr) {
- return ::dux::fmter(nullptr);
- }
- return ::dux::priv::intfmter(_fmt);
-}
diff --git a/include/dux/io.d/print.hh b/include/dux/io.d/print.hh
deleted file mode 100644
index 3833583..0000000
--- a/include/dux/io.d/print.hh
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <cstdio>
-
-template<typename... Ts> constexpr auto ::dux::print(::dux::str const & _str,Ts... _args) -> void {
- auto const str = ::dux::fmt(_str,_args...);
- if (str.len() == 0x0uz) [[unlikely]] {
- throw ::dux::invalarg("Too many format options!");
- }
- if (::std::fwrite(str.u8().begin(),0x1uz,str.len(),stdout) < str.len()) {
- throw ::dux::runerr("Unable to write to stout!");
- }
-}
diff --git a/include/dux/io.hh b/include/dux/io.hh
deleted file mode 100644
index b431cc6..0000000
--- a/include/dux/io.hh
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-/*
- to-do:
- Implement a prettier (and larger) API for I/O operations!
-*/
-
-namespace dux {
- class fmterr : public ::dux::except {
- public:
- using ::dux::except::except;
- };
-
- template<typename... Ts> constexpr auto dbgprint(::dux::str const & str,Ts... args) -> void;
- constexpr auto fmt( ::dux::str const & str) -> ::dux::str;
- template<typename T> constexpr auto fmt( ::dux::str const & str,T fmt) -> ::dux::str;
- template<typename T,typename... Ts> constexpr auto fmt( ::dux::str const & str,T fmt, Ts... args) -> ::dux::str;
- template<typename T> constexpr auto fmter( T fmt) -> ::dux::str;
- template<typename... Ts> constexpr auto print( ::dux::str const & str,Ts... args) -> void;
- inline auto base {::dux::ubytev(0xC)};
- constexpr auto fmtchr{U'\u0024'};
-}
-
-#include <dux/io.d/dbgprint.hh>
-#include <dux/io.d/fmt.hh>
-#include <dux/io.d/fmter.hh>
-#include <dux/io.d/print.hh>
diff --git a/include/dux/media.hh b/include/dux/media.hh
deleted file mode 100644
index 70c748e..0000000
--- a/include/dux/media.hh
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- enum class evttyp : ::dux::ubyte {
- kbd,
- mus,
- quit,
- resz,
- unknwn,
- };
-
- class evt {
- public:
- ::dux::evttyp typ{::dux::evttyp::unknwn};
- };
-
- class win {
- public:
- auto close() -> void;
- auto mv( ::dux::uint16 x, ::dux::uint16 y) -> void;
- [[nodiscard]] static auto crt( char const * nm,::dux::uint16 w,::dux::uint16 h) -> ::dux::win;
- auto destr() noexcept -> void;
- auto open() -> void;
- auto renm( char const * nm) -> void;
- auto resz( ::dux::uint16 w, ::dux::uint16 h) -> void;
- auto pollevt() noexcept -> ::dux::opt<::dux::evt>;
- [[nodiscard]] win();
- [[nodiscard]] win( ::dux::win const & oth);
- ~win() noexcept;
- private:
- void * const dux_restr _dat;
- bool _isopen{false};
- };
-
- auto endgfx() -> void;
- auto initgfx() -> void;
-}
diff --git a/include/dux/str.d/cnv.hh b/include/dux/str.d/cnv.hh
deleted file mode 100644
index 13c9d1a..0000000
--- a/include/dux/str.d/cnv.hh
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-template<::dux::utf T,::dux::utf T0> constexpr auto ::dux::cnv(T0 const * const dux_restr _begin,T0 const * const dux_restr _end) -> ::dux::arr<T> {
- if (_begin == nullptr || _end == nullptr) [[unlikely]] {
- throw ::dux::invalarg("Null pointer provided as parameter.");
- }
- ::dux::arr<T0> in(_begin,_end);
- ::dux::arr<T> out;
- if constexpr (::dux::issame<T0,T>) {
- out.alloc(static_cast<::dux::usz>(_end - _begin));
- ::dux::cpy(_begin,_end,out.begin());
- return out;
- }
- else {
- if constexpr (::dux::issame<T0,char16_t>) {
- }
- else if constexpr (::dux::issame<T0,char32_t>) {
- for (auto const tmp : in) {
- if constexpr (::dux::issame<T,char16_t>) {
- if (tmp >= ::dux::uint32v(0x10000)) { /* Two hextets. */
- char16_t const tmp0 = tmp - ::dux::uint16v(0x10000);
- out.app((tmp0 / ::dux::uint16v(0x400) + ::dux::uint16v(0xD800)));
- out.app((tmp0 % ::dux::uint16v(0x400) + ::dux::uint16v(0xDC00)));
- }
- else [[likely]] {
- /* One hextet. */
- out.app((static_cast<char16_t>(tmp)));
- }
- }
- else {
- if (tmp >= ::dux::uint32v(0x10000)) { /* Four octets. */
- out.app((::dux::ubytev(0b11110000) + static_cast<char8_t>(tmp >> ::dux::uint32v(0x12) & ::dux::uint32v(0b00000111))));
- out.app((::dux::ubytev(0b10000000) + static_cast<char8_t>(tmp >> ::dux::uint32v(0xC) & ::dux::uint32v(0b00111111))));
- out.app((::dux::ubytev(0b10000000) + static_cast<char8_t>(tmp >> ::dux::uint32v(0x6) & ::dux::uint32v(0b00111111))));
- out.app((::dux::ubytev(0b10000000) + static_cast<char8_t>(tmp & ::dux::uint32v(0b00111111))));
- }
- else if (tmp >= U'\u0800') { /* Three octets. */
- out.app((::dux::ubytev(0xE0) + static_cast<char8_t>(tmp >> ::dux::uint32v(0xC) & ::dux::uint32v(0b00001111))));
- out.app((::dux::ubytev(0x80) + static_cast<char8_t>(tmp >> ::dux::uint32v(0x6) & ::dux::uint32v(0b00111111))));
- out.app((::dux::ubytev(0x80) + static_cast<char8_t>(tmp & ::dux::uint32v(0b00111111))));
- }
- else if (tmp >= U'\u0080') { /* Two octets. */
- out.app((::dux::ubytev(0xC0) + static_cast<char8_t>(tmp >> ::dux::uint32v(0x6) & ::dux::uint32v(0b00111111))));
- out.app((::dux::ubytev(0x80) + static_cast<char8_t>(tmp & ::dux::uint32v(0b00111111))));
- }
- else [[likely]] {
- /* One octet. */
- out.app(static_cast<char8_t>(tmp));
- }
- }
- }
- }
- else {
- if constexpr (::dux::issame<T,char16_t>) {
- }
- else {
- for (::dux::usz n = 0x0uz;n < in.sz();n += 0x1uz) {
- auto const tmp = in[n];
- auto chr = U'\u0000';
- if (tmp >= ::dux::ubytev(0b11110000)) { /* Four octets. */
- chr = (tmp ^ ::dux::uint32v(0b11110000)) << ::dux::uint32v(0x12);
- chr += (in[n + 0x1uz] ^ ::dux::uint32v(0b10000000)) << ::dux::uint32v(0xC);
- chr += (in[n + 0x2uz] ^ ::dux::uint32v(0b10000000)) << ::dux::uint32v(0x6);
- chr += in[n + 0x3uz] ^ ::dux::uint32v(0b10000000);
- n += 0x3uz;
- }
- else if (tmp >= ::dux::ubytev(0b11100000)) { /* Three octets. */
- chr = (tmp ^ ::dux::uint32v(0b11100000)) << ::dux::uint32v(0xC);
- chr += (in[n + 0x1uz] ^ ::dux::uint32v(0b10000000)) << ::dux::uint32v(0x6);
- chr += in[n + 0x2uz] ^ ::dux::uint32v(0b10000000);
- n += 0x2uz;
- }
- else if (tmp >= ::dux::ubytev(0b11000000)) { /* Two octets. */
- chr = (tmp ^ ::dux::uint32v(0b11000000)) << ::dux::uint32v(0x6);
- chr += in[n + 0x1uz] ^ ::dux::uint32v(0b10000000);
- n += 0x1uz;
- }
- else [[likely]] {
- /* One octet. */
- chr = tmp;
- }
- out.app(chr);
- }
- }
- }
- }
- return out;
-}
diff --git a/include/dux/str.d/str.hh b/include/dux/str.d/str.hh
deleted file mode 100644
index d5bdf20..0000000
--- a/include/dux/str.d/str.hh
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::str::begin() noexcept -> char32_t * {
- return this->_arr.begin();
-}
-constexpr auto ::dux::str::begin() const noexcept -> char32_t const * {
- return this->_arr.begin();
-}
-constexpr auto ::dux::str::cbegin() const noexcept -> char32_t const * {
- return this->_arr.cbegin();
-}
-constexpr auto ::dux::str::cend() const noexcept -> char32_t const * {
- return this->_arr.cbegin();
-}
-constexpr auto ::dux::str::del(::dux::usz const _pos) -> void {
- this->_arr.del(_pos);
-}
-constexpr auto ::dux::str::end() noexcept -> char32_t * {
- return this->_arr.end();
-}
-constexpr auto ::dux::str::end() const noexcept -> char32_t const * {
- return this->_arr.end();
-}
-constexpr auto ::dux::str::fnd(char32_t const _chr) const noexcept -> ::dux::usz {
- for (auto pos = 0x0uz;pos < this->len();pos += 0x1uz) {
- if (this->operator [] (pos) == _chr) [[unlikely]] {
- return pos;
- }
- }
- return ::dux::npos;
-}
-constexpr auto ::dux::str::ins(::dux::usz const _pos,::dux::str const & _oth) -> ::dux::str const & {
- this->_arr.ins(_oth._arr,_pos);
- return *this;
-}
-constexpr auto ::dux::str::len() const noexcept -> ::dux::usz {
- return this->_arr.sz();
-}
-constexpr auto ::dux::str::operator + (::dux::str const & _oth) const -> ::dux::str {
- auto str = *this;
- str._arr.app(_oth._arr);
- return str;
-}
-constexpr auto ::dux::str::operator = (::dux::str const & _oth) -> ::dux::str const & {
- this->_arr = _oth._arr;
- return *this;
-}
-constexpr auto ::dux::str::operator == (::dux::str const & _oth) const noexcept -> bool {
- if (this->len() != _oth.len()) {
- return false;
- }
- for (auto n = 0x0uz;n < this->len() && n < _oth.len();n += 0x1uz) {
- if ((*this)[n] != _oth[n]) {
- return false;
- }
- }
- return true;
-}
-constexpr auto ::dux::str::operator [] (::dux::usz const _pos) noexcept -> char32_t & {
- return this->_arr[_pos];
-}
-constexpr auto ::dux::str::operator [] (::dux::usz const _pos) const noexcept -> char32_t const & {
- return this->_arr[_pos];
-}
-constexpr ::dux::str::str(char32_t const _chr) {
- this->_arr.app(_chr);
-}
-constexpr ::dux::str::str(::dux::str const & _oth) {
- *this = _oth;
-}
-constexpr ::dux::str::str(::dux::str && _oth) {
- this->_arr.setraw(_oth._arr.begin(),_oth._arr.sz());
- _oth._arr.setraw(nullptr,0x0uz);
-}
-template<::dux::usz N> constexpr ::dux::str::str(char32_t const (& _strlit)[N]) noexcept {
- this->_arr = _strlit;
-}
-template<::dux::utf T> constexpr ::dux::str::str(T const _chr) {
- if constexpr (::dux::issame<T,char32_t>) {
- this->_arr.alloc(0x1uz);
- this->_arr[0x0uz] = _chr;
- }
-}
-template<::dux::utf T> constexpr ::dux::str::str(T const * const dux_restr _utf) {
- auto const sz = [&]() {
- for (auto n = 0x0uz;;n += 0x1uz) {
- if (_utf[n] == T{0x0}) {
- return n;
- }
- }
- }();
- this->_arr = ::dux::cnv<char32_t>(_utf,_utf + sz);
-}
-constexpr auto ::dux::str::sub(::dux::usz const _pos,::dux::usz const _len) const -> ::dux::str {
- ::dux::str str;
- str._arr = this->_arr.sub(_pos,_len);
- return str;
-}
-constexpr auto ::dux::str::u8() const -> ::dux::arr<char8_t> {
- return ::dux::cnv<char8_t>(this->begin(),this->end());
-}
diff --git a/include/dux/str.d/uninm.hh b/include/dux/str.d/uninm.hh
deleted file mode 100644
index 7c40d2c..0000000
--- a/include/dux/str.d/uninm.hh
+++ /dev/null
@@ -1,2720 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-constexpr auto ::dux::uninm(char32_t const _chr) -> ::dux::str{
- switch(_chr) {
- [[unlikely]] default:
- if(_chr > ::dux::unimax) [[unlikely]] {
- throw ::dux::invalutf("Character out of range.");
- }
- return U"UNDEFINED IN UNICODE";
- /* BASIC LATIN: */
- case U'\u0000':
- return U"NULL";
- case U'\u0001':
- return U"START OF HEADING";
- case U'\u0002':
- return U"START OF TEXT";
- case U'\u0003':
- return U"END OF TEXT";
- case U'\u0004':
- return U"END OF TRANSMISSION";
- case U'\u0005':
- return U"ENQUIRY";
- case U'\u0006':
- return U"ACKNOWLEDGE";
- case U'\u0007':
- return U"BELL";
- case U'\u0008':
- return U"BACKSPACE";
- case U'\u0009':
- return U"HORIZONTAL TABULATION";
- case U'\u000A':
- return U"NEW LINE";
- case U'\u000B':
- return U"VERTICAL TABULATION";
- case U'\u000C':
- return U"FORM FEED";
- case U'\u000D':
- return U"CARRIAGE RETURN";
- case U'\u000E':
- return U"SHIFT OUT";
- case U'\u000F':
- return U"SHIFT IN";
- case U'\u0010':
- return U"DATA LINK ESCAPE";
- case U'\u0011':
- return U"DEVICE CONTROL ONE";
- case U'\u0012':
- return U"DEVICE CONTROL TWO";
- case U'\u0013':
- return U"DEVICE CONTROL THREE";
- case U'\u0014':
- return U"DEVICE CONTROL FOUR";
- case U'\u0015':
- return U"NEGATIVE ACKNOWLEDGE";
- case U'\u0016':
- return U"SYNCHRONOUS IDLE";
- case U'\u0017':
- return U"END OF TRANSMISSION BLOCk";
- case U'\u0018':
- return U"CANCEL";
- case U'\u0019':
- return U"END OF MEDIUM";
- case U'\u001A':
- return U"SUBSTITUTE";
- case U'\u001B':
- return U"ESCAPE";
- case U'\u001C':
- return U"FILE SEPERATOR";
- case U'\u001D':
- return U"GROUP SEPERATOR";
- case U'\u001E':
- return U"RECORD SEPERATOR";
- case U'\u001F':
- return U"UNIT SEPERATOR";
- case U'\u0020':
- return U"SPACE";
- case U'\u0021':
- return U"EXCLAMATION MARK";
- case U'\u0022':
- return U"QUOTATION MARK";
- case U'\u0023':
- return U"NUMBER SIGN";
- case U'\u0024':
- return U"DOLLAR SIGN";
- case U'\u0025':
- return U"PERCENT SIGN";
- case U'\u0026':
- return U"AMPERSAND";
- case U'\u0027':
- return U"APOSTROPHE";
- case U'\u0028':
- return U"LEFT PARANTHESIS";
- case U'\u0029':
- return U"RIGHT PARANTHESIS";
- case U'\u002A':
- return U"ASTERISK";
- case U'\u002B':
- return U"PLUS SIGN";
- case U'\u002C':
- return U"COMMA";
- case U'\u002D':
- return U"HYPHEN-MINUS";
- case U'\u002E':
- return U"FULL STOP";
- case U'\u002F':
- return U"SOLIDUS";
- case U'\u0030':
- return U"DIGIT ZERO";
- case U'\u0031':
- return U"DIGIT ONE";
- case U'\u0032':
- return U"DIGIT TWO";
- case U'\u0033':
- return U"DIGIT THREE";
- case U'\u0034':
- return U"DIGIT FOUR";
- case U'\u0035':
- return U"DIGIT FIVE";
- case U'\u0036':
- return U"DIGIT SIX";
- case U'\u0037':
- return U"DIGIT SEVEN";
- case U'\u0038':
- return U"DIGIT EIGHT";
- case U'\u0039':
- return U"DIGIT NINE";
- case U'\u003A':
- return U"COLON";
- case U'\u003B':
- return U"SEMICOLON";
- case U'\u003C':
- return U"LESS-THAN SIGN";
- case U'\u003D':
- return U"EQUALS SIGN";
- case U'\u003E':
- return U"GREATER-THAN SIGN";
- case U'\u003F':
- return U"QUESTION MARK";
- case U'\u0040':
- return U"COMMERCIAL AT";
- case U'\u0041':
- return U"LATIN CAPITAL LETTER A";
- case U'\u0042':
- return U"LATIN CAPITAL LETTER B";
- case U'\u0043':
- return U"LATIN CAPITAL LETTER C";
- case U'\u0044':
- return U"LATIN CAPITAL LETTER D";
- case U'\u0045':
- return U"LATIN CAPITAL LETTER E";
- case U'\u0046':
- return U"LATIN CAPITAL LETTER F";
- case U'\u0047':
- return U"LATIN CAPITAL LETTER G";
- case U'\u0048':
- return U"LATIN CAPITAL LETTER H";
- case U'\u0049':
- return U"LATIN CAPITAL LETTER I";
- case U'\u004A':
- return U"LATIN CAPITAL LETTER J";
- case U'\u004B':
- return U"LATIN CAPITAL LETTER K";
- case U'\u004C':
- return U"LATIN CAPITAL LETTER L";
- case U'\u004D':
- return U"LATIN CAPITAL LETTER M";
- case U'\u004E':
- return U"LATIN CAPITAL LETTER N";
- case U'\u004F':
- return U"LATIN CAPITAL LETTER O";
- case U'\u0050':
- return U"LATIN CAPITAL LETTER P";
- case U'\u0051':
- return U"LATIN CAPITAL LETTER Q";
- case U'\u0052':
- return U"LATIN CAPITAL LETTER R";
- case U'\u0053':
- return U"LATIN CAPITAL LETTER S";
- case U'\u0054':
- return U"LATIN CAPITAL LETTER T";
- case U'\u0055':
- return U"LATIN CAPITAL LETTER U";
- case U'\u0056':
- return U"LATIN CAPITAL LETTER V";
- case U'\u0057':
- return U"LATIN CAPITAL LETTER W";
- case U'\u0058':
- return U"LATIN CAPITAL LETTER X";
- case U'\u0059':
- return U"LATIN CAPITAL LETTER Y";
- case U'\u005A':
- return U"LATIN CAPITAL LETTER Z";
- case U'\u005B':
- return U"LEFT SQUARE BRACKET";
- case U'\u005C':
- return U"REVERSE SOLIDUS";
- case U'\u005D':
- return U"RIGHT SQUARE BRACKET";
- case U'\u005E':
- return U"CIRCUMFLEX ACCENT";
- case U'\u005F':
- return U"LOW LINE";
- case U'\u0060':
- return U"GRAVE ACCENT";
- case U'\u0061':
- return U"LATIN SMALL LETTER A";
- case U'\u0062':
- return U"LATIN SMALL LETTER B";
- case U'\u0063':
- return U"LATIN SMALL LETTER C";
- case U'\u0064':
- return U"LATIN SMALL LETTER D";
- case U'\u0065':
- return U"LATIN SMALL LETTER E";
- case U'\u0066':
- return U"LATIN SMALL LETTER F";
- case U'\u0067':
- return U"LATIN SMALL LETTER G";
- case U'\u0068':
- return U"LATIN SMALL LETTER H";
- case U'\u0069':
- return U"LATIN SMALL LETTER I";
- case U'\u006A':
- return U"LATIN SMALL LETTER J";
- case U'\u006B':
- return U"LATIN SMALL LETTER K";
- case U'\u006C':
- return U"LATIN SMALL LETTER L";
- case U'\u006D':
- return U"LATIN SMALL LETTER M";
- case U'\u006E':
- return U"LATIN SMALL LETTER N";
- case U'\u006F':
- return U"LATIN SMALL LETTER O";
- case U'\u0070':
- return U"LATIN SMALL LETTER P";
- case U'\u0071':
- return U"LATIN SMALL LETTER Q";
- case U'\u0072':
- return U"LATIN SMALL LETTER R";
- case U'\u0073':
- return U"LATIN SMALL LETTER S";
- case U'\u0074':
- return U"LATIN SMALL LETTER T";
- case U'\u0075':
- return U"LATIN SMALL LETTER U";
- case U'\u0076':
- return U"LATIN SMALL LETTER V";
- case U'\u0077':
- return U"LATIN SMALL LETTER W";
- case U'\u0078':
- return U"LATIN SMALL LETTER X";
- case U'\u0079':
- return U"LATIN SMALL LETTER Y";
- case U'\u007A':
- return U"LATIN SMALL LETTER Z";
- case U'\u007B':
- return U"LEFT CURLY BRACKET";
- case U'\u007C':
- return U"VERTICAL LINE";
- case U'\u007D':
- return U"RIGHT CURLY BRACKET";
- case U'\u007E':
- return U"TILDE";
- case U'\u007F':
- return U"DELETE";
- /* LATIN-1 SUPPLEMENT: */
- case U'\u0080':
- return U"PADDING CHARACTER";
- case U'\u0081':
- return U"HIGH OCTET PRESET";
- case U'\u0082':
- return U"BREAK PERMITTED HERE";
- case U'\u0083':
- return U"NO BREAK HERE";
- case U'\u0084':
- return U"INDEX";
- case U'\u0085':
- return U"NEXT LINE";
- case U'\u0086':
- return U"START OF SELECTED AREA";
- case U'\u0087':
- return U"END OF SELECTED AREA";
- case U'\u0088':
- return U"CHARACTER TABULATION SET";
- case U'\u0089':
- return U"CHARACTER TABULATION WITH JUSTIFICATION";
- case U'\u008A':
- return U"LINE TABULATION SET";
- case U'\u008B':
- return U"PARTIAL LINE FORWARD";
- case U'\u008C':
- return U"PARTIAL LINE BACKWARD";
- case U'\u008D':
- return U"REVERSE LINE FEED";
- case U'\u008E':
- return U"SINGLE SHIFT TWO";
- case U'\u008F':
- return U"SINGLE SHIFT THREE";
- case U'\u0090':
- return U"DEVICE CONTROL STRING";
- case U'\u0091':
- return U"PRIVATE USE ONE";
- case U'\u0092':
- return U"PRIVATE USE TWO";
- case U'\u0093':
- return U"SET TRANSMIT STATE";
- case U'\u0094':
- return U"CANCEL CHARACTER";
- case U'\u0095':
- return U"MESSAGE WAITING";
- case U'\u0096':
- return U"START OF GUARDED AREA";
- case U'\u0097':
- return U"END OF GUARDED AREA";
- case U'\u0098':
- return U"START OF STRING";
- case U'\u0099':
- return U"SINGLE GRAPHIC CHARACTER INTRODUCER";
- case U'\u009A':
- return U"SINGLE CHARACTER INTRODUCER";
- case U'\u009B':
- return U"CONTROL SEQUENCE INTRODUCER";
- case U'\u009C':
- return U"STRING TERMINATOR";
- case U'\u009D':
- return U"OPERATING SYSTEM COMMAND";
- case U'\u009E':
- return U"PRIVACY MESSAGE";
- case U'\u009F':
- return U"APPLICATION PROGRAM COMMAND";
- case U'\u00A0':
- return U"NO-BREAK SPACE";
- case U'\u00A1':
- return U"INVERTED EXCLAMATION MARK";
- case U'\u00A2':
- return U"CENT SIGN";
- case U'\u00A3':
- return U"POUND SIGN";
- case U'\u00A4':
- return U"CURRENCY SIGN";
- case U'\u00A5':
- return U"YEN SIGN";
- case U'\u00A6':
- return U"BROKEN BAR";
- case U'\u00A7':
- return U"SECTION SIGN";
- case U'\u00A8':
- return U"DIAERESIS";
- case U'\u00A9':
- return U"COPYRIGHT SIGN";
- case U'\u00AA':
- return U"FEMININE ORDINAL INDICATOR";
- case U'\u00AB':
- return U"LEFT-POINTING DOUBLE ANGLE QUOTATION MARK";
- case U'\u00AC':
- return U"NOT SIGN";
- case U'\u00AD':
- return U"SOFT HYPHEN";
- case U'\u00AE':
- return U"REGISTERED SIGN";
- case U'\u00AF':
- return U"MACRON";
- case U'\u00B0':
- return U"DEGREE SIGN";
- case U'\u00B1':
- return U"PLUS MINUS SYMBOL";
- case U'\u00B2':
- return U"SUPERSCRIPT TWO";
- case U'\u00B3':
- return U"SUPERSCRIPT THREE";
- case U'\u00B4':
- return U"ACUTE ACCENT";
- case U'\u00B5':
- return U"MICRO SIGN";
- case U'\u00B6':
- return U"PILCROW SIGN";
- case U'\u00B7':
- return U"MIDDLE DOT";
- case U'\u00B8':
- return U"CEDILLA";
- case U'\u00B9':
- return U"SUPERSCRIPT ONE";
- case U'\u00BA':
- return U"MASCULINE ORDINAL INDICATOR";
- case U'\u00BB':
- return U"RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK";
- case U'\u00BC':
- return U"VULGAR FRACTION ONE QUARTER";
- case U'\u00BD':
- return U"VULGAR FRACTION ONE HALF";
- case U'\u00BE':
- return U"VULGAR FRACTION THREE QUARTERS";
- case U'\u00BF':
- return U"INVERTED QUESTION MARK";
- case U'\u00C0':
- return U"LATIN CAPITAL LETTER A WITH GRAVE";
- case U'\u00C1':
- return U"LATIN CAPITAL LETTER A WITH ACUTE";
- case U'\u00C2':
- return U"LATIN CAPITAL LETTER A WITH CIRCUMFLEX";
- case U'\u00C3':
- return U"LATIN CAPITAL LETTER A WITH TILDE";
- case U'\u00C4':
- return U"LATIN CAPITAL LETTER A WITH DIAERESIS";
- case U'\u00C5':
- return U"LATIN CAPITAL LETTER A WITH RING ABOVE";
- case U'\u00C6':
- return U"LATIN CAPITAL LETTER AE";
- case U'\u00C7':
- return U"LATIN CAPITAL LETTER C WITH CEDILLA";
- case U'\u00C8':
- return U"LATIN CAPITAL LETTER E WITH GRAVE";
- case U'\u00C9':
- return U"LATIN CAPITAL LETTER E WITH ACUTE";
- case U'\u00CA':
- return U"LATIN CAPITAL LETTER E WITH CIRCUMFLEX";
- case U'\u00CB':
- return U"LATIN CAPITAL LETTER E WITH DIAERESIS";
- case U'\u00CC':
- return U"LATIN CAPITAL LETTER I WITH GRAVE";
- case U'\u00CD':
- return U"LATIN CAPITAL LETTER I WITH ACUTE";
- case U'\u00CE':
- return U"LATIN CAPITAL LETTER I WITH CIRCUMFLEX";
- case U'\u00CF':
- return U"LATIN CAPITAL LETTER I WITH DIAERESIS";
- case U'\u00D0':
- return U"LATIN CAPITAL LETTER ETH";
- case U'\u00D1':
- return U"LATIN CAPITAL LETTER N WITH TILDE";
- case U'\u00D2':
- return U"LATIN CAPITAL LETTER O WITH GRAVE";
- case U'\u00D3':
- return U"LATIN CAPITAL LETTER O WITH ACUTE";
- case U'\u00D4':
- return U"LATIN CAPITAL LETTER O WITH CIRCUMFLEX";
- case U'\u00D5':
- return U"LATIN CAPITAL LETTER O WITH TILDE";
- case U'\u00D6':
- return U"LATIN CAPITAL LETTER O WITH DIAERESIS";
- case U'\u00D7':
- return U"MULTIPLICATION SIGN";
- case U'\u00D8':
- return U"LATIN CAPITAL LETTER O WITH STROKE";
- case U'\u00D9':
- return U"LATIN CAPITAL LETTER U WITH GRAVE";
- case U'\u00DA':
- return U"LATIN CAPITAL LETTER U WITH ACUTE";
- case U'\u00DB':
- return U"LATIN CAPITAL LETTER U WITH CIRCUMFLEX";
- case U'\u00DC':
- return U"LATIN CAPITAL LETTER U WITH DIAERESIS";
- case U'\u00DD':
- return U"LATIN CAPITAL LETTER Y WITH ACUTE";
- case U'\u00DE':
- return U"LATIN CAPITAL LETTER THORN";
- case U'\u00DF':
- return U"LATIN SMALL LETTER SHARP S";
- case U'\u00E0':
- return U"LATIN SMALL LETTER A WITH GRAVE";
- case U'\u00E1':
- return U"LATIN SMALL LETTER A WITH ACUTE";
- case U'\u00E2':
- return U"LATIN SMALL LETTER A WITH CIRCUMFLEX";
- case U'\u00E3':
- return U"LATIN SMALL LETTER A WITH TILDE";
- case U'\u00E4':
- return U"LATIN SMALL LETTER A WITH DIAERESIS";
- case U'\u00E5':
- return U"LATIN SMALL LETTER A WITH RING ABOVE";
- case U'\u00E6':
- return U"LATIN SMALL LETTER AE";
- case U'\u00E7':
- return U"LATIN SMALL LETTER C WITH CEDILLA";
- case U'\u00E8':
- return U"LATIN SMALL LETTER E WITH GRAVE";
- case U'\u00E9':
- return U"LATIN SMALL LETTER E WITH ACUTE";
- case U'\u00EA':
- return U"LATIN SMALL LETTER E WITH CIRCUMFLEX";
- case U'\u00EB':
- return U"LATIN SMALL LETTER E WITH DIAERESIS";
- case U'\u00EC':
- return U"LATIN SMALL LETTER I WITH GRAVE";
- case U'\u00ED':
- return U"LATIN SMALL LETTER I WITH ACUTE";
- case U'\u00EE':
- return U"LATIN SMALL LETTER I WITH CIRCUMFLEX";
- case U'\u00EF':
- return U"LATIN SMALL LETTER I WITH DIAERESIS";
- case U'\u00F0':
- return U"LATIN SMALL LETTER ETH";
- case U'\u00F1':
- return U"LATIN SMALL LETTER N WITH TILDE";
- case U'\u00F2':
- return U"LATIN SMALL LETTER O WITH GRAVE";
- case U'\u00F3':
- return U"LATIN SMALL LETTER O WITH ACUTE";
- case U'\u00F4':
- return U"LATIN SMALL LETTER O WITH CIRCUMFLEX";
- case U'\u00F5':
- return U"LATIN SMALL LETTER O WITH TILDE";
- case U'\u00F6':
- return U"LATIN SMALL LETTER O WITH DIAERESIS";
- case U'\u00F7':
- return U"DIVISION SIGN";
- case U'\u00F8':
- return U"LATIN SMALL LETTER O WITH STROKE";
- case U'\u00F9':
- return U"LATIN SMALL LETTER U WITH GRAVE";
- case U'\u00FA':
- return U"LATIN SMALL LETTER U WITH ACUTE";
- case U'\u00FB':
- return U"LATIN SMALL LETTER U WITH CIRCUMFLEX";
- case U'\u00FC':
- return U"U WITH TWO DOTS";
- case U'\u00FD':
- return U"LATIN SMALL LETTER Y WITH ACUTE";
- case U'\u00FE':
- return U"LATIN SMALL LETTER THORN";
- case U'\u00FF':
- return U"LATIN SMALL LETTER Y WITH DIAERESIS";
- /* LATIN EXTENDED-A: */
- case U'\u0100':
- return U"LATIN CAPITAL LETTER A WITH MACRON";
- case U'\u0101':
- return U"LATIN SMALL LETTER A WITH MACRON";
- case U'\u0102':
- return U"LATIN CAPITAL LETTER A WITH BREVE";
- case U'\u0103':
- return U"LATIN SMALL LETTER A WITH BREVE";
- case U'\u0104':
- return U"LATIN CAPITAL LETTER A WITH OGONEK";
- case U'\u0105':
- return U"LATIN SMALL LETTER A WITH OGONEK";
- case U'\u0106':
- return U"LATIN CAPITAL LETTER C WITH ACUTE";
- case U'\u0107':
- return U"LATIN SMALL LETTER C WITH ACUTE";
- case U'\u0108':
- return U"LATIN CAPITAL LETTER C WITH CIRCUMFLEX";
- case U'\u0109':
- return U"LATIN SMALL LETTER C WITH CIRCUMFLEX";
- case U'\u010A':
- return U"LATIN CAPITAL LETTER C WITH DOT ABOVE";
- case U'\u010B':
- return U"LATIN SMALL LETTER C WITH DOT ABOVE";
- case U'\u010C':
- return U"LATIN CAPITAL LETTER C WITH CARON";
- case U'\u010D':
- return U"LATIN SMALL LETTER C WITH CARON";
- case U'\u010E':
- return U"LATIN CAPITAL LETTER D WITH CARON";
- case U'\u010F':
- return U"LATIN SMALL LETTER D WITH CARON";
- case U'\u0110':
- return U"LATIN CAPITAL LETTER D WITH STROKE";
- case U'\u0111':
- return U"LATIN SMALL LETTER D WITH STROKE";
- case U'\u0112':
- return U"LATIN CAPITAL LETTER E WITH MACRON";
- case U'\u0113':
- return U"LATIN SMALL LETTER E WITH MACRON";
- case U'\u0114':
- return U"LATIN CAPITAL LETTER E WITH BREVE";
- case U'\u0115':
- return U"LATIN SMALL LETTER E WITH BREVE";
- case U'\u0116':
- return U"LATIN CAPITAL LETTER E WITH DOT ABOVE";
- case U'\u0117':
- return U"LATIN SMALL LETTER E WITH DOT ABOVE";
- case U'\u0118':
- return U"LATIN CAPITAL LETTER E WITH OGONEK";
- case U'\u0119':
- return U"LATIN SMALL LETTER E WITH OGONEK";
- case U'\u011A':
- return U"LATIN CAPITAL LETTER E WITH CARON";
- case U'\u011B':
- return U"LATIN SMALL LETTER E WITH CARON";
- case U'\u011C':
- return U"LATIN CAPITAL LETTER G WITH CIRCUMFLEX";
- case U'\u011D':
- return U"LATIN SMALL LETTER G WITH CIRCUMFLEX";
- case U'\u011E':
- return U"LATIN CAPITAL LETTER G WITH BREVE";
- case U'\u011F':
- return U"LATIN SMALL LETTER G WITH BREVE";
- case U'\u0120':
- return U"LATIN CAPITAL LETTER G WITH DOT ABOVE";
- case U'\u0121':
- return U"LATIN SMALL LETTER G WITH DOT ABOVE";
- case U'\u0122':
- return U"LATIN CAPITAL LETTER G WITH CEDILLA";
- case U'\u0123':
- return U"LATIN SMALL LETTER G WITH CEDILLA";
- case U'\u0124':
- return U"LATIN CAPITAL LETTER H WITH CIRCUMFLEX";
- case U'\u0125':
- return U"LATIN SMALL LETTER H WITH CIRCUMFLEX";
- case U'\u0126':
- return U"LATIN CAPITAL LETTER H WITH STROKE";
- case U'\u0127':
- return U"LATIN SMALL LETTER H WITH STROKE";
- case U'\u0128':
- return U"LATIN CAPITAL LETTER I WITH TILDE";
- case U'\u0129':
- return U"LATIN SMALL LETTER I WITH TILDE";
- case U'\u012A':
- return U"LATIN CAPITAL LETTER I WITH MACRON";
- case U'\u012B':
- return U"LATIN SMALL LETTER I WITH MACRON";
- case U'\u012C':
- return U"LATIN CAPITAL LETTER I WITH BREVE";
- case U'\u012D':
- return U"LATIN SMALL LETTER I WITH BREVE";
- case U'\u012E':
- return U"LATIN CAPITAL LETTER I WITH OGONEK";
- case U'\u012F':
- return U"LATIN SMALL LETTER I WITH OGONEK";
- case U'\u0130':
- return U"LATIN CAPITAL LETTER I WITH DOT ABOVE";
- case U'\u0131':
- return U"LATIN SMALL LETTER DOTLESS I";
- case U'\u0132':
- return U"LATIN CAPITAL LIGATURE IJ";
- case U'\u0133':
- return U"LATIN SMALL LIGATURE IJ";
- case U'\u0134':
- return U"LATIN CAPITAL LETTER J WITH CIRCUMFLEX";
- case U'\u0135':
- return U"LATIN SMALL LETTER J WITH CIRCUMFLEX";
- case U'\u0136':
- return U"LATIN CAPITAL LETTER K WITH CEDILLA";
- case U'\u0137':
- return U"LATIN SMALL LETTER K WITH CEDILLA";
- case U'\u0138':
- return U"LATIN SMALL LETTER KRA";
- case U'\u0139':
- return U"LATIN CAPITAL LETTER L WITH ACUTE";
- case U'\u013A':
- return U"LATIN SMALL LETTER L WITH ACUTE";
- case U'\u013B':
- return U"LATIN CAPITAL LETTER L WITH CEDILLA";
- case U'\u013C':
- return U"LATIN SMALL LETTER L WITH CEDILLA";
- case U'\u013D':
- return U"LATIN CAPITAL LETTER L WITH CARON";
- case U'\u013E':
- return U"LATIN SMALL LETTER L WITH CARON";
- case U'\u013F':
- return U"LATIN CAPITAL LETTER L WITH MDDLE DOT";
- case U'\u0140':
- return U"LATIN SMALL LETTER L WITH MIDDLE DOT";
- case U'\u0141':
- return U"LATIN CAPITAL LETTER L WITH STROKE";
- case U'\u0142':
- return U"LATIN SMALL LETTER L WITH STROKE";
- case U'\u0143':
- return U"LATIN CAPITAL LETTER N WITH ACUTE";
- case U'\u0144':
- return U"LATIN SMALL LETTER N WITH ACUTE";
- case U'\u0145':
- return U"LATIN CAPITAL LETTER N WITH CEDILLA";
- case U'\u0146':
- return U"LATIN SMALL LETTER N WITH CEDILLA";
- case U'\u0147':
- return U"LATIN CAPITAL LETTER N WITH CARON";
- case U'\u0148':
- return U"LATIN SMALL LETTER N WITH CARON";
- case U'\u0149':
- return U"LATIN SMALL LETTER N PRECEDED BY APOSTROPHE";
- case U'\u014A':
- return U"LATIN CAPITAL LETTER ENG";
- case U'\u014B':
- return U"LATIN SMALL LETTER ENG";
- case U'\u014C':
- return U"LATIN CAPITAL LETTER O WITH MACRON";
- case U'\u014D':
- return U"LATIN SMALL LETTER O WITH MACRON";
- case U'\u014E':
- return U"LATIN CAPITAL LETTER O WITH BREVE";
- case U'\u014F':
- return U"LATIN SMALL LETTER O WITH BREVE";
- case U'\u0150':
- return U"LATIN CAPITAL LETTER O WITH DOUBLE ACUTE";
- case U'\u0160':
- return U"LATIN CAPITAL LETTER S WITH CARON";
- case U'\u0170':
- return U"LATIN CAPITAL LETTER U WITH DOUBLE ACUTE";
- /* LATIN EXTENDED-B: */
- case U'\u0180':
- return U"LATIN SMALL LETTER B WITH STROKE";
- case U'\u0190':
- return U"LATIN CAPITAL LETTER OPEN E";
- case U'\u01A0':
- return U"LATIN CAPITAL LETTER O WITH HORN";
- case U'\u01B0':
- return U"LATIN SMALL LETTER U WITH HORN";
- case U'\u01C0':
- return U"LATIN LETTER DENTAL CLICK";
- case U'\u01D0':
- return U"LATIN SMALL LETTER I WITH CARON";
- case U'\u01E0':
- return U"LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON";
- case U'\u01F0':
- return U"LATIN SMALL LETTER J WITH CARON";
- case U'\u0200':
- return U"LATIN CAPITAL LETTER A WITH DOUBLE GRAVE";
- case U'\u0210':
- return U"LATIN CAPITAL LETTER R WITH DOUBLE GRAVE";
- case U'\u0220':
- return U"LATIN CAPITAL LETTER N WITH LONG RIGHT LEG";
- case U'\u0230':
- return U"LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON";
- case U'\u0240':
- return U"LATIN SMALL LETTER Z WITH SWASH TAIL";
- /* IPA EXTENSIONS: */
- case U'\u0250':
- return U"LATIN SMALL LETTER TURNED A";
- case U'\u0251':
- return U"LATIN SMALL LETTER ALPHA";
- case U'\u0252':
- return U"LATIN SMALL LETTER TURNED ALPHA";
- case U'\u0253':
- return U"LATIN SMALL LETTER B WITH HOOK";
- case U'\u0254':
- return U"LATIN SMALL LETTER OPEN O";
- case U'\u0255':
- return U"LATIN SMALL LETTER C WITH CURL";
- case U'\u0256':
- return U"LATIN SMALL LETTER D WITH TAIL";
- case U'\u0257':
- return U"LATIN SMALL LETTER D WITH HOOK";
- case U'\u0258':
- return U"LATIN SMALL LETTER REVERSED E";
- case U'\u0259':
- return U"LATIN SMALL LETTER SCHWA";
- case U'\u025A':
- return U"LATIN SMALL LETTER SCHWA WITH HOOK";
- case U'\u025B':
- return U"LATIN SMALL LETTER OPEN E";
- case U'\u025C':
- return U"LATIN SMALL LETTER REVERSED OPEN E";
- case U'\u025D':
- return U"LATIN SMALL LETTER REVERSED OPEN E WITH HOOK";
- case U'\u025E':
- return U"LATIN SMALL LETTER CLOSED REVERSED OPEN E";
- case U'\u025F':
- return U"LATIN SMALL LETTER DOTLESS J WITH STROKE";
- case U'\u0260':
- return U"LATIN SMALL LETTER G WITH HOOK";
- case U'\u0261':
- return U"LATIN SMALL LETTER SCRIPT G";
- case U'\u0262':
- return U"LATIN LETTER SMALL CAPITAL G";
- case U'\u0263':
- return U"LATIN SMALL LETTER GAMMA";
- case U'\u0264':
- return U"LATIN SMALL LETTER RAMS HORN";
- case U'\u0265':
- return U"LATIN SMALL LETTER TURNED H";
- case U'\u0266':
- return U"LATIN SMALL LETTER H WITH HOOK";
- case U'\u0267':
- return U"LATIN SMALL LETTER HENG WITH HOOK";
- case U'\u0268':
- return U"LATIN SMALL LETTER I WITH STROKE";
- case U'\u0269':
- return U"LATIN SMALL LETTER IOTA";
- case U'\u026A':
- return U"LATIN LETTER SMALL CAPITAL I";
- case U'\u026B':
- return U"LATIN SMALL LETTER L WITH MIDDLE TILDE";
- case U'\u026C':
- return U"LATIN SMALL LETTER L WITH BELT";
- case U'\u026D':
- return U"LATIN SMALL LETTER L WITH RETROFLEX HOOK";
- case U'\u026E':
- return U"LATIN SMALL LETTER LEZH";
- case U'\u026F':
- return U"LATIN SMALL LETTER TURNED M";
- case U'\u0270':
- return U"LATIN SMALL LETTER TURNED M WITH LONG LEG";
- case U'\u0271':
- return U"LATIN SMALL LETTER M WITH HOOK";
- case U'\u0272':
- return U"LATIN SMALL LETTER N WITH LEFT HOOK";
- case U'\u0273':
- return U"LATIN SMALL LETTER N WITH RETROFLEX HOOK";
- case U'\u0274':
- return U"LATIN LETTER SMALL CAPITAL N";
- case U'\u0275':
- return U"LATIN SMALL LETTER BARRED O";
- case U'\u0276':
- return U"LATIN LETTER SMALL CAPITAL OE";
- case U'\u0277':
- return U"LATIN SMALL LETTER CLOSED OMEGA";
- case U'\u0278':
- return U"LATIN SMALL LETTER PHI";
- case U'\u0279':
- return U"LATIN SMALL LETTER TURNED R";
- case U'\u027A':
- return U"LATIN SMALL LETTER TURNED R WITH LONG LEG";
- case U'\u027B':
- return U"LATIN SMALL LETTER TURNED R WITH HOOK";
- case U'\u027C':
- return U"LATIN SMALL LETTER R WITH LONG LEG";
- case U'\u027D':
- return U"LATIN SMALL LETTER R WITH TAIL";
- case U'\u027E':
- return U"LATIN SMALL LETTER R WITH FISHHOOK";
- case U'\u027F':
- return U"LATIN SMALL LETTER REVERSED R WITH FISHHOOK";
- case U'\u0280':
- return U"LATIN LETTER SMALL CAPITAL R";
- case U'\u0281':
- return U"LATIN LETTER SMALL CAPITAL INVERTED R";
- case U'\u0282':
- return U"LATIN SMALL LETTER S WITH HOOK";
- case U'\u0283':
- return U"LATIN SMALL LETTER ESH";
- case U'\u0284':
- return U"LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK";
- case U'\u0285':
- return U"LATIN SMALL LETTER SQUAT REVERSED ESH";
- case U'\u0286':
- return U"LATIN SMALL LETTER SH WITH CURL";
- case U'\u0287':
- return U"LATIN SMALL LETTER TURNED T";
- case U'\u0288':
- return U"LATIN SMALL LETTER T WITH RETROFLEX HOOK";
- case U'\u0289':
- return U"LATIN SMALL LETTER U BAR";
- case U'\u028A':
- return U"LATIN SMALL LETTER UPSILON";
- case U'\u028B':
- return U"LATIN SMALL LETTER V WTIH HOOK";
- case U'\u028C':
- return U"LATIN SMALL LETTER TURNED V";
- case U'\u028D':
- return U"LATIN SMALL LETTER TURNED W";
- case U'\u028E':
- return U"LATIN SMALL LETTER TURNED Y";
- case U'\u028F':
- return U"LATIN LETTER SMALL CAPITAL Y";
- case U'\u0290':
- return U"LATIN SMALL LETTER Z WITH RETROFLEX HOOK";
- case U'\u0291':
- return U"LATIN SMALL LETTER Z WITH RETROFLEX";
- case U'\u0292':
- return U"LATIN SMALL LETTER EZH";
- case U'\u0293':
- return U"LATIN SMALL LETTER EZH WITH CURL";
- case U'\u0294':
- return U"LATIN LETTER GLOTTAL STOP";
- case U'\u0295':
- return U"LATIN LETTER PHARYNGEAL VOICED FRICATIVE";
- case U'\u0296':
- return U"LATIN LETTER INVERTED GLOTTAL STOP";
- case U'\u0297':
- return U"LATIN LETTER STRETCHED C";
- case U'\u0298':
- return U"LATIN LETTER BILABIAL CLICK";
- case U'\u0299':
- return U"LATIN LETTER SMALL CAPITAL B";
- case U'\u029A':
- return U"LATIN SMALL LETTER CLOSED OPEN E";
- case U'\u029B':
- return U"LATIN LETTER SMALL CAPITAL G WITH HOOK";
- case U'\u029C':
- return U"LATIN LETTER SMALL CAPITAL H";
- case U'\u029D':
- return U"LATIN SMALL LETTER J WITH CROSSED-TAIL";
- case U'\u029E':
- return U"LATIN SMALL LETTER TURNED K";
- case U'\u029F':
- return U"LATIN LETTER SMALL CAPITAL L";
- case U'\u02A0':
- return U"LATIN SMALL LETTER Q WITH HOOK";
- case U'\u02A1':
- return U"LATIN LETTER GLOTTAL STOP WITH STROKE";
- case U'\u02A2':
- return U"LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE";
- case U'\u02A3':
- return U"LATIN SMALL LETTER DZ DIGRAPH";
- case U'\u02A4':
- return U"LATIN SMALL LETTER DEZH DIGRAPH";
- case U'\u02A5':
- return U"LATIN SMALL LETTER DZ DIGRAPH WITH CURL";
- case U'\u02A6':
- return U"LATIN SMALL LETTER TS DIGRAPH";
- case U'\u02A7':
- return U"LATIN SMALL LETTER TESH DIGRAPH";
- case U'\u02A8':
- return U"LATIN SMALL LETTER TC DIGRAPH WITH CURL";
- case U'\u02A9':
- return U"LATIN SMALL LETTER FENG DIGRAPH";
- case U'\u02AA':
- return U"LATIN SMALL LETTER LS DIGRAPH";
- case U'\u02AB':
- return U"LATIN SMALL LETTER LZ DIGRAPH";
- case U'\u02AC':
- return U"LATIN LETTER BILABIAL PERCUSSIVE";
- case U'\u02AD':
- return U"LATIN LETTER BIDENTAL PERCUSSIVE";
- case U'\u02AE':
- return U"LATIN SMALL LETTER TURNED H WITH FISHHOOK";
- case U'\u02AF':
- return U"LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL";
- /* SPACING MODIFIER LETTERS: */
- case U'\u02B0':
- return U"MODIFIER LETTER SMALL H";
- case U'\u02B1':
- return U"MODIFIER LETTER SMALL H WITH HOOK";
- case U'\u02B2':
- return U"MODIFIER LETTER SMALL J";
- case U'\u02B3':
- return U"MODIFIER LETTER SMALL R";
- case U'\u02B4':
- return U"MODIFIER LETTER SMALL TURNED R";
- case U'\u02B5':
- return U"MODIFIER LETTER SMALL TURNED R WITH HOOK";
- case U'\u02B6':
- return U"MODIFIER LETTER SMALL CAPITAL INVERTED R";
- case U'\u02B7':
- return U"MODIFIER LETTER SMALL W";
- case U'\u02B8':
- return U"MODIFIER LETTER SMALL Y";
- case U'\u02B9':
- return U"MODIFIER LETTER PRIME";
- case U'\u02BA':
- return U"MODIFIER LETTER DOUBLE PRIME";
- case U'\u02BB':
- return U"MODIFIER LETTER TURNED COMMA";
- case U'\u02BC':
- return U"MODIFIER LETTER APOSTROPHE";
- case U'\u02BD':
- return U"MODIFIER LETTER REVERSED COMMA";
- case U'\u02BE':
- return U"MODIFIER LETTER RIGHT HALF RING";
- case U'\u02BF':
- return U"MODIFIER LETTER LEFT HALF RING";
- case U'\u02C0':
- return U"MODIFIER LETTER GLOTTAL STOP";
- case U'\u02C1':
- return U"MODIFIER LETTER REVERSED GLOTTAL STOP";
- case U'\u02C2':
- return U"MODIFIER LETTER LEFT ARROWHEAD";
- case U'\u02C3':
- return U"MODIFIER LETTER RIGHT ARROWHEAD";
- case U'\u02C4':
- return U"MODIFIER LETTER UP ARROWHEAD";
- case U'\u02C5':
- return U"MODIFIER LETTER DOWN ARROWHEAD";
- case U'\u02C6':
- return U"MODIFIER LETTER CIRCUMFLEX";
- case U'\u02C7':
- return U"CARON";
- case U'\u02C8':
- return U"MODIFIER LETTER VERTICAL LINE";
- case U'\u02C9':
- return U"MODIFIER LETTER MACRON";
- case U'\u02CA':
- return U"MODIFIER LETTER ACUTE ACCENT";
- case U'\u02CB':
- return U"MODIFIER LETTER GRAVE ACCENT";
- case U'\u02CC':
- return U"MODIFIER LETTER LOW VERTICAL LINE";
- case U'\u02CD':
- return U"MODIFIER LETTER LOW MACRON";
- case U'\u02CE':
- return U"MODIFIER LETTER LOW GRAVE ACCENT";
- case U'\u02CF':
- return U"MODIFIER LETTER LOW ACUTE ACCENT";
- case U'\u02D0':
- return U"MODIFIER LETTER TRIANGULAR COLON";
- case U'\u02D1':
- return U"MODIFIER LETTER HALF TRIANGULAR COLON";
- case U'\u02D2':
- return U"MODIFIER LETTER CENTRED RIGHT HALF RING";
- case U'\u02D3':
- return U"MODIFIER LETTER CENTRED LEFT HALF RING";
- case U'\u02D4':
- return U"MODIFIER LETTER UP TACK";
- case U'\u02D5':
- return U"MODIFIER LETTER DOWN TACK";
- case U'\u02D6':
- return U"MODIFIER LETTER PLUS SIGN";
- case U'\u02D7':
- return U"MODIFIER LETTER MINUS SIGN";
- case U'\u02D8':
- return U"BREVE";
- case U'\u02D9':
- return U"DOT ABOVE";
- case U'\u02DA':
- return U"RING ABOVE";
- case U'\u02DB':
- return U"OGONEK";
- case U'\u02DC':
- return U"SMALL TILDE";
- case U'\u02DD':
- return U"DOUBLE ACUTE ACCENT";
- case U'\u02DE':
- return U"MODIFIER LETTER RHOTIC HOOK";
- case U'\u02DF':
- return U"MODIFIER LETTER CROSS ACCENT";
- case U'\u02E0':
- return U"MODIFIER LETTER SMALL GAMMA";
- case U'\u02E1':
- return U"MODIFIER LETTER SMALL L";
- case U'\u02E2':
- return U"MODIFIER LETTER SMALL S";
- case U'\u02E3':
- return U"MODIFIER LETTER SMALL X";
- case U'\u02E4':
- return U"MODIFIER LETTER SMALL REVERSED GLOTTAL STOP";
- case U'\u02E5':
- return U"MODIFIER LETTER EXTRA-HIGH TONE BAR";
- case U'\u02E6':
- return U"MODIFIER LETTER HIGH TONE BAR";
- case U'\u02E7':
- return U"MODIFIER LETTER MID TONE BAR";
- case U'\u02E8':
- return U"MODIFIER LETTER LOW TONE BAR";
- case U'\u02E9':
- return U"MODIFIER LETTER EXTRA-LOW TONE BAR";
- case U'\u02EA':
- return U"MODIFIER LETTER YIN DEPARTING TONE MARK";
- case U'\u02EB':
- return U"MODIFIER LETTER YANG DEPARTING TONE MARK";
- case U'\u02EC':
- return U"MODIFIER LETTER VOICING";
- case U'\u02ED':
- return U"MODIFIER LETTER UNASPIRATED";
- case U'\u02EE':
- return U"MODIFIER LETTER DOUBLE APOSTROPHE";
- case U'\u02EF':
- return U"MODIFIER LETTER LOW DOWN ARROWHEAD";
- case U'\u02F0':
- return U"MODIFIER LETTER LOW UP ARROWHEAD";
- case U'\u02F1':
- return U"MODIFIER LETTER LOW LEFT ARROWHEAD";
- case U'\u02F2':
- return U"MODIFIER LETTER LOW RIGHT ARROWHEAD";
- case U'\u02F3':
- return U"MODIFIER LETTER LOW RING";
- case U'\u02F4':
- return U"MODIFIER LETTER MIDDLE GRAVE ACCENT";
- case U'\u02F5':
- return U"MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT";
- case U'\u02F6':
- return U"MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT";
- case U'\u02F7':
- return U"MODIFIER LETTER LOW TILDE";
- case U'\u02F8':
- return U"MODIFIER LETTER RAISED COLON";
- case U'\u02F9':
- return U"MODIFIER LETTER BEGIN HIGH TONE";
- case U'\u02FA':
- return U"MODIFIER LETTER END HIGH TONE";
- case U'\u02FB':
- return U"MODIFIER LETTER BEGIN LOW TONE";
- case U'\u02FC':
- return U"MODIFIER LETTER END LOW TONE";
- case U'\u02FD':
- return U"MODIFIER LETTER SHELF";
- case U'\u02FE':
- return U"MODIFIER LETTER OPEN SHELF";
- case U'\u02FF':
- return U"MODIFIER LETTER LOW LEFT ARROWHEAD";
- /* COMBINING DIACRITICAL MARKS: */
- case U'\u0300':
- return U"COMBINING GRAVE ACCENT";
- case U'\u0301':
- return U"COMBINING ACUTE ACCENT";
- case U'\u0302':
- return U"COMBINING CIRCUMFLEX ACCENT";
- case U'\u0303':
- return U"COMBINING TILDE";
- case U'\u0304':
- return U"COMBINING MACRON";
- case U'\u0305':
- return U"COMBINING OVERLINE";
- case U'\u0306':
- return U"COMBINING BREVE";
- case U'\u0307':
- return U"COMBINING DOT ABOVE";
- case U'\u0308':
- return U"COMBINING DIAERESIS";
- case U'\u0309':
- return U"COMBINING HOOK ABOVE";
- case U'\u030A':
- return U"COMBINING RING ABOVE";
- case U'\u030B':
- return U"COMBINING DOUBLE ACUTE ACCENT";
- case U'\u030C':
- return U"COMBINING CARON";
- case U'\u030D':
- return U"COMBINING VERTICAL LINE ABOVE";
- case U'\u030E':
- return U"COMBINING DOUBLE VERTICAL LINE ABOVE";
- case U'\u030F':
- return U"COMBINING DOUBLE GRAVE ACCENT";
- case U'\u0310':
- return U"COMBINING CANDRABINDU";
- case U'\u0311':
- return U"COMBINING INVERTED BREVE";
- case U'\u0312':
- return U"COMBINING TURNED COMMA ABOVE";
- case U'\u0313':
- return U"COMBINING COMMA ABOVE";
- case U'\u0314':
- return U"COMBINING REVERSED COMMA ABOVE";
- case U'\u0315':
- return U"COMBINING COMMA ABOVE RIGHT";
- case U'\u0316':
- return U"COMBINING GRAVE ACCENT BELOW";
- case U'\u0317':
- return U"COMBINING ACUTE ACCENT BELOW";
- case U'\u0318':
- return U"COMBINING LEFT TACK BELOW";
- case U'\u0319':
- return U"COMBINING RIGHT TACK BELOW";
- case U'\u031A':
- return U"COMBINING LEFT ANGLE ABOVE";
- case U'\u031B':
- return U"COMBINING HORN";
- case U'\u031C':
- return U"COMBINING LEFT HALF RING BELOW";
- case U'\u031D':
- return U"COMBINING UP TACK BELOW";
- case U'\u031E':
- return U"COMBINING DOWN TACK BELOW";
- case U'\u031F':
- return U"COMBINING PLUS SIGN BELOW";
- case U'\u0320':
- return U"COMBINING MINUS SIGN BELOW";
- case U'\u0321':
- return U"COMBINING PALATALIZED HOOK BELOW";
- case U'\u0322':
- return U"COMBINING RETROFLEX HOOK BELOW";
- case U'\u0323':
- return U"COMBINING DOT BELOW";
- case U'\u0324':
- return U"COMBINING DIAERESIS BELOW";
- case U'\u0325':
- return U"COMBINING RING BELOW";
- case U'\u0326':
- return U"COMBINING COMMA BELOW";
- case U'\u0327':
- return U"COMBINING CEDILLA";
- case U'\u0328':
- return U"COMBINING OGONEK";
- case U'\u0329':
- return U"COMBINING VERTICAL LINE BELOW";
- case U'\u032A':
- return U"COMBINING BRDIGE BELOW";
- case U'\u032B':
- return U"COMBINING INVERTED DOUBLE ARCH BELOW";
- case U'\u032C':
- return U"COMBINING CARON BELOW";
- case U'\u032D':
- return U"COMBINING CIRCUMFLEX ACCENT BELOW";
- case U'\u032E':
- return U"COMBINING BREVE BELOW";
- case U'\u032F':
- return U"COMBINING INVERTED BREVE BELOW";
- case U'\u0330':
- return U"COMBINING TILDE BELOW";
- case U'\u0331':
- return U"COMBINING MACRON BELOW";
- case U'\u0332':
- return U"COMBINING LOW LINE";
- case U'\u0333':
- return U"COMBINING DOUBLE LOW LINE";
- case U'\u0334':
- return U"COMBINING TILDE OVERLAY";
- case U'\u0335':
- return U"COMBINING SHORT STROKE OVERLAY";
- case U'\u0336':
- return U"COMBINING LONG STROKE OVERLAY";
- case U'\u0337':
- return U"COMBINING SHORT SOLIDUS OVERLAY";
- case U'\u0338':
- return U"COMBINING LONG SOLIDUS OVERLAY";
- case U'\u0339':
- return U"COMBINING RIGHT HALF RING BELOW";
- case U'\u033A':
- return U"COMBINING INVERTED BRIDGE BELOW";
- case U'\u033B':
- return U"COMBINING SQUARE BELOW";
- case U'\u033C':
- return U"COMBINING SEAGULL BELOW";
- case U'\u033D':
- return U"COMBINING X ABOVE";
- case U'\u033E':
- return U"COMBINING VERTICAL TILDE";
- case U'\u033F':
- return U"COMBINING DOUBLE OVERLINE";
- case U'\u0340':
- return U"COMBINING GRAVE TONE MARK";
- case U'\u0341':
- return U"COMBINING ACUTE TONE MARK";
- case U'\u0342':
- return U"COMBINING GREEK PERISPOMENI";
- case U'\u0343':
- return U"COMBINING GREEK KORONIS";
- case U'\u0344':
- return U"COMBINING GREEK DIALYTIKA TONOS";
- case U'\u0345':
- return U"COMBINING GREEK YPOGEGRAMMENI";
- case U'\u0346':
- return U"COMBINING BRIDGE ABOVE";
- case U'\u0347':
- return U"COMBINING EQUALS SIGN BELOW";
- case U'\u0348':
- return U"COMBINING DOUBLE VERTICAL LINE BELOW";
- case U'\u0349':
- return U"COMBINING LEFT ANGLE BELOW";
- case U'\u034A':
- return U"COMBINING NOT TILDE ABOVE";
- case U'\u034B':
- return U"COMBINING HOMOTHETIC ABOVE";
- case U'\u034C':
- return U"COMBINING ALMOST EQUAL TO ABOVE";
- case U'\u034D':
- return U"COMBINING LEFT RIGHT ARROW BELOW";
- case U'\u034E':
- return U"COMBINING UPWARDS ARROW BELOW";
- case U'\u034F':
- return U"COMBINING GRAPHEME JOINER";
- case U'\u0350':
- return U"COMBINING RIGHT ARROWHEAD ABOVE";
- case U'\u0351':
- return U"COMBINING LEFT HALF RING ABOVE";
- case U'\u0352':
- return U"COMBINING FERMATA";
- case U'\u0353':
- return U"COMBINING X BELOW";
- case U'\u0354':
- return U"COMBINING LEFT ARROWHEAD BELOW";
- case U'\u0355':
- return U"COMBINING RIGHT ARROWHEAD BELOW";
- case U'\u0356':
- return U"COMBINING RIGHT ARROWHEAD AND UP ARROWHEAD BELOW";
- case U'\u0357':
- return U"COMBINING RIGHT HALF RING ABOVE";
- case U'\u0358':
- return U"COMBINING DOT ABOVE RIGHT";
- case U'\u0359':
- return U"COMBINING ASTERISK BELOW";
- case U'\u035A':
- return U"COMBINING DOUBLE RING BELOW";
- case U'\u035B':
- return U"COMBINING ZIGZAG ABOVE";
- case U'\u035C':
- return U"COMBINING DOUBLE BREVE BELOW";
- case U'\u035D':
- return U"COMBINING DOUBLE BREVE";
- case U'\u035E':
- return U"COMBINING DOUBLE MACRON";
- case U'\u035F':
- return U"COMBINING DOUBLE MACRON BELOW";
- case U'\u0360':
- return U"COMBINING DOUBLE TILDE";
- case U'\u0361':
- return U"COMBINING DOUBLE INVERTED BREVE";
- case U'\u0362':
- return U"COMBINING DOUBLE RIGHTWARDS ARROW BELOW";
- case U'\u0363':
- return U"COMBINING LATIN SMALL LETTER A";
- case U'\u0364':
- return U"COMBINING LATIN SMALL LETTER E";
- case U'\u0365':
- return U"COMBINING LATIN SMALL LETTER I";
- case U'\u0366':
- return U"COMBINING LATIN SMALL LETTER O";
- case U'\u0367':
- return U"COMBINING LATIN SMALL LETTER U";
- case U'\u0368':
- return U"COMBINING LATIN SMALL LETTER C";
- case U'\u0369':
- return U"COMBINING LATIN SMALL LETTER D";
- case U'\u036A':
- return U"COMBINING LATIN SMALL LETTER H";
- case U'\u036B':
- return U"COMBINING LATIN SMALL LETTER M";
- case U'\u036C':
- return U"COMBINING LATIN SMALL LETTER R";
- case U'\u036D':
- return U"COMBINING LATIN SMALL LETTER T";
- case U'\u036E':
- return U"COMBINING LATIN SMALL LETTER V";
- case U'\u036F':
- return U"COMBINING LATIN SMALL LETTER X";
- /* GREEK AND COPTIC: */
- case U'\u0370':
- return U"GREEK CAPITAL LETTER HETA";
- case U'\u0371':
- return U"GREEK SMALL LETTER HETA";
- case U'\u0372':
- return U"GREEK CAPITAL LETTER ARCHAIC SAMPI";
- case U'\u0373':
- return U"GREEK SMALL LETTER ARCHAIC SAMPI";
- case U'\u0374':
- return U"GREEK NUMERAL SIGN";
- case U'\u0375':
- return U"GREEK LOWER NUMERAL SIGN";
- case U'\u0376':
- return U"GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA";
- case U'\u0377':
- return U"GREEK SMALL LETTER PAMPHYLIAN DIGAMMA";
- case U'\u037A':
- return U"GREEK YPOGEGRAMMENI";
- case U'\u037B':
- return U"GREEK SMALL REVERSED LUNATE SIGMA SYMBOL";
- case U'\u037C':
- return U"GREEK SMALL DOTTED LUNATE SIGMA SYMBOL";
- case U'\u037D':
- return U"GREEK SMALL REVERSED DOTTED LUNATE SIGMAL SYMBOL";
- case U'\u037E':
- return U"GREEK QUESTION MARK";
- case U'\u037F':
- return U"GREEK CAPITAL LETTER YOT";
- case U'\u0384':
- return U"GREEK TONOS";
- case U'\u0385':
- return U"GREEK DIALYTIKA TONOS";
- case U'\u0386':
- return U"GREEK CAPITAL LETTER ALPHA WITH TONOS";
- case U'\u0387':
- return U"GREEK ANO TELEIA";
- case U'\u0388':
- return U"GREEK CAPITAL LETTER EPSILON WITH TONOS";
- case U'\u0389':
- return U"GREEK CAPITAL LETTER ETA WITH TONOS";
- case U'\u038A':
- return U"GREEK CAPITAL LETTER IOTA WITH TONOS";
- case U'\u038C':
- return U"GREEK CAPITAL LETTER OMICRON WITH TONOS";
- case U'\u038E':
- return U"GREEK CAPITAL LETTER USPILON WITH TONOS";
- case U'\u038F':
- return U"GREEK CAPITAL LETTER OMEGA WITH TONOS";
- case U'\u0390':
- return U"GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS";
- case U'\u0391':
- return U"GREEK CAPITAL LETTER ALPHA";
- case U'\u0392':
- return U"GREEK CAPITAL LETTER BETA";
- case U'\u0393':
- return U"GREEK CAPITAL LETTER GAMMA";
- case U'\u0394':
- return U"GREEK CAPITAL LETTER DELTA";
- case U'\u0395':
- return U"GREEK CAPITAL LETTER EPSILON";
- case U'\u0396':
- return U"GREEK CAPITAL LETTER ZETA";
- case U'\u0397':
- return U"GREEK CAPITAL LETTER ETA";
- case U'\u0398':
- return U"GREEK CAPITAL LETTER THETA";
- case U'\u0399':
- return U"GREEK CAPITAL LETTER IOTA";
- case U'\u039A':
- return U"GREEK CAPITAL LETTER KAPPA";
- case U'\u039B':
- return U"GREEK CAPITAL LETTER LAMBDA";
- case U'\u039C':
- return U"GREEK CAPITAL LETTER MU";
- case U'\u039D':
- return U"GREEK CAPITAL LETTER NU";
- case U'\u039E':
- return U"GREEK CAPITAL LETTER XI";
- case U'\u039F':
- return U"GREEK CAPITAL LETTER OMICRON";
- case U'\u03A0':
- return U"GREEK CAPITAL LETTER PI";
- case U'\u03A1':
- return U"GREEK CAPITAL LETTER RHO";
- case U'\u03A3':
- return U"GREEK CAPITAL LETTER SIGMA";
- case U'\u03A4':
- return U"GREEK CAPITAL LETTER TAU";
- case U'\u03A5':
- return U"GREEK CAPITAL LETTER UPSILON";
- case U'\u03A6':
- return U"GREEK CAPITAL LETTER PHI";
- case U'\u03A7':
- return U"GREEK CAPITAL LETTER CHI";
- case U'\u03A8':
- return U"GREEK CAPITAL LETTER PSI";
- case U'\u03A9':
- return U"GREEK CAPITAL LETTER OMEGA";
- case U'\u03AA':
- return U"GREEK CAPITAL LETTER IOTA WITH DIALYTIKA";
- case U'\u03AB':
- return U"GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA";
- case U'\u03AC':
- return U"GREEK SMALL LETTER ALPHA WITH TONOS";
- case U'\u03AD':
- return U"GREEK SMALL LETTER EPSILON WITH TONOS";
- case U'\u03AE':
- return U"GREEK SMALL LETTER ETA WITH TONOS";
- case U'\u03AF':
- return U"GREEK SMALL LETTER IOTA WITH TONOS";
- case U'\u03B0':
- return U"GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS";
- case U'\u03B1':
- return U"GREEK SMALL LETTER ALPHA";
- case U'\u03B2':
- return U"GREEK SMALL LETTER BETA";
- case U'\u03B3':
- return U"GREEK SMALL LETTER GAMMA";
- case U'\u03B4':
- return U"GREEK SMALL LETTER DELTA";
- case U'\u03B5':
- return U"GREEK SMALL LETTER EPSILON";
- case U'\u03B6':
- return U"GREEK SMALL LETTER ZETA";
- case U'\u03B7':
- return U"GREEK SMALL LETTER ETA";
- case U'\u03B8':
- return U"GREEK SMALL LETTER THETA";
- case U'\u03B9':
- return U"GREEK SMALL LETTER IOTA";
- case U'\u03BA':
- return U"GREEK SMALL LETTER KAPPA";
- case U'\u03BB':
- return U"GREEK SMALL LETTER LAMBDA";
- case U'\u03BC':
- return U"GREEK SMALL LETTER MU";
- case U'\u03BD':
- return U"GREEK SMALL LETTER NU";
- case U'\u03BE':
- return U"GREEK SMALL LETTER XI";
- case U'\u03BF':
- return U"GREEK SMALL LETTER OMICRON";
- case U'\u03C0':
- return U"GREEK SMALL LETTER PI";
- case U'\u03C1':
- return U"GREEK SMALL LETTER RHO";
- case U'\u03C2':
- return U"GREEK SMALL LETTER FINAL SIGMA";
- case U'\u03C3':
- return U"GREEK SMALL LETTER SIGMA";
- case U'\u03C4':
- return U"GREEK SMALL LETTER TAU";
- case U'\u03C5':
- return U"GREEK SMALL LETTER UPSILON";
- case U'\u03C6':
- return U"GREEK SMALL LETTER PHI";
- case U'\u03C7':
- return U"GREEK SMALL LETTER CHI";
- case U'\u03C8':
- return U"GREEK SMALL LETTER PSI";
- case U'\u03C9':
- return U"GREEK SMALL LETTER OMEGA";
- case U'\u03CA':
- return U"GREEK SMALL LETTER IOTA WITH DIALYTIKA";
- case U'\u03CB':
- return U"GREEK SMALL LETTER UPSILON WITH DIALYTIKA";
- case U'\u03CC':
- return U"GREEK SMALL LETTER OMICRON WITH TONOS";
- case U'\u03CD':
- return U"GREEK SMALL LETTER UPSILON WITH TONOS";
- case U'\u03CE':
- return U"GREEK SMALL LETTER OMEGA WITH TONOS";
- case U'\u03CF':
- return U"GREEK CAPITAL KAI SYMBOL";
- case U'\u03D0':
- return U"GREEK BETA SYMBOL";
- case U'\u03D1':
- return U"GREEK THETA SYMBOL";
- case U'\u03D2':
- return U"GREEK UPSILON WITH HOOK SYMBOL";
- case U'\u03D3':
- return U"GREEK UPSILON WITH ACUTE AND HOOK SYMBOL";
- case U'\u03D4':
- return U"GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL";
- case U'\u03D5':
- return U"GREEK PHI SYMBOL";
- case U'\u03D6':
- return U"GREEK PI SYMBOL";
- case U'\u03D7':
- return U"GREEK KAI SYMBOL";
- case U'\u03D8':
- return U"GREEK LETTER ARCHAIC KOPPA";
- case U'\u03D9':
- return U"GREEK SMALL LETTER ARCHAIC KOPPA";
- case U'\u03DA':
- return U"GREEK LETTER STIGMA";
- case U'\u03DB':
- return U"GREEK SMALL LETTER STIGMA";
- case U'\u03DC':
- return U"GREEK LETTER DIGAMMA";
- case U'\u03DD':
- return U"GREEK SMALL LETTER DIGAMMA";
- case U'\u03DE':
- return U"GREEK LETTER KOPPA";
- case U'\u03DF':
- return U"GREEK SMALL LETTER KOPPA";
- case U'\u03E0':
- return U"GREEK LETTER SAMPI";
- case U'\u03F0':
- return U"GREEK KAPPA SYMBOL";
- /* HEBREW: */
- case U'\u05D0':
- return U"HEBREW LETTER ALEF";
- case U'\u05D1':
- return U"HEBREW LETTER BET";
- case U'\u05D2':
- return U"HEBREW LETTER GIMEL";
- case U'\u05D3':
- return U"HEBREW LETTER DALET";
- case U'\u05D4':
- return U"HEBREW LETTER HE";
- case U'\u05D5':
- return U"HEBREW LETTER VAV";
- case U'\u05D6':
- return U"HEBREW LETTER ZAYIN";
- case U'\u05D7':
- return U"HEBREW LETTER HET";
- case U'\u05D8':
- return U"HEBREW LETTER TET";
- case U'\u05D9':
- return U"HEBREW LETTER YOD";
- case U'\u05DA':
- return U"HEBREW LETTER FINAL KAF";
- case U'\u05DB':
- return U"HEBREW LETTER KAF";
- case U'\u05DC':
- return U"HEBREW LETTER LAMED";
- case U'\u05DD':
- return U"HEBREW LETTER FINAL MEM";
- case U'\u05DE':
- return U"HEBREW LETTER MEM";
- case U'\u05DF':
- return U"HEBREW LETTER FINAL NUN";
- case U'\u05E0':
- return U"HEBREW LETTER NUN";
- case U'\u05E1':
- return U"HEBREW LETTER SAMEKH";
- case U'\u05E2':
- return U"HEBREW LETTER AYIN";
- case U'\u05E3':
- return U"HEBREW LETTER FINAL PE";
- case U'\u05E4':
- return U"HEBREW LETTER PE";
- case U'\u05E5':
- return U"HEBREW LETTER FINAL TSADI";
- case U'\u05E6':
- return U"HEBREW LETTER TSADI";
- case U'\u05E7':
- return U"HEBREW LETTER QOF";
- case U'\u05E8':
- return U"HEBREW LETTER RESH";
- case U'\u05E9':
- return U"HEBREW LETTER SHIN";
- case U'\u05EA':
- return U"HEBREW LETTER TAV";
- case U'\u05EF':
- return U"HEBREW YOD TRIANGLE";
- /* CYRILLIC: */
- case U'\u0400':
- return U"CYRILLIC CAPITAL LETTER LE WITH GRAVE";
- case U'\u0401':
- return U"CYRILLIC CAPITAL LETTER LO";
- case U'\u0402':
- return U"CYRILLIC CAPITAL LETTER DJE";
- case U'\u0403':
- return U"CYRILLIC CAPITAL LETTER GJE";
- case U'\u0404':
- return U"CYRILLIC CAPITAL LETTER UKRAINIAN LE";
- case U'\u0405':
- return U"CYRILLIC CAPITAL LETTER DZE";
- case U'\u0406':
- return U"CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I";
- case U'\u0407':
- return U"CYRILLIC CAPITAL LETTER YI";
- case U'\u0408':
- return U"CYRILLIC CAPITAL LETTER JE";
- case U'\u0409':
- return U"CYRILLIC CAPITAL LETTER LJE";
- case U'\u040A':
- return U"CYRILLIC CAPITAL LETTER NJE";
- case U'\u040B':
- return U"CYRILLIC CAPITAL LETTER TSHE";
- case U'\u040C':
- return U"CYRILLIC CAPITAL LETTER KJE";
- case U'\u040D':
- return U"CYRILLIC CAPITAL LETTER I WITH GRAVE";
- case U'\u040E':
- return U"CYRILLIC CAPITAL LETTER SHORT U";
- case U'\u040F':
- return U"CYRILLIC CAPITAL LETTER DZHE";
- case U'\u0410':
- return U"CYRILLIC CAPITAL LETTER A";
- case U'\u0420':
- return U"CYRILLIC CAPITAL LETTER ER";
- case U'\u0430':
- return U"CYRILLIC SMALL LETTER A";
- case U'\u0440':
- return U"CYRILLIC SMALL LETTER ER";
- case U'\u0450':
- return U"CYRILLIC SMALL LETTER LE WITH GRAVE";
- case U'\u0460':
- return U"CYRILLIC CAPITAL LETTER OMEGA";
- case U'\u0470':
- return U"CYRILLIC CAPITAL LETTER PSI";
- case U'\u0480':
- return U"CYRILLIC CAPITAL LETTER KOPPA";
- case U'\u0490':
- return U"CYRILLIC CAPITAL LETTER GHE WITH UPTURN";
- case U'\u04A0':
- return U"CYRILLIC CAPITAL LETTER BASHKIR KA";
- case U'\u04B0':
- return U"CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE";
- case U'\u04C0':
- return U"CYRILLIC LETTER PALOCHKA";
- case U'\u04D0':
- return U"CYRILLIC CAPITAL LETTER A WITH BREVE";
- case U'\u04E0':
- return U"CYRILLIC CAPITAL LETTER ABKHASIAN DZE";
- case U'\u04F0':
- return U"CYRILLIC CAPITAL LETTER U WITH DIAERESIS";
- /* SYRIAC SUPPLEMENT: */
- case U'\u0860':
- return U"SYRIAC LETTER MALAYALAM NGA";
- case U'\u0861':
- return U"SYRIAC LETTER MALAYALAM JA";
- case U'\u0862':
- return U"SYRIAC LETTER MALAYALAM NYA";
- case U'\u0863':
- return U"SYRIAC LETTER MALAYALAM TTA";
- case U'\u0864':
- return U"SYRIAC LETTER MALAYALAM NNA";
- case U'\u0865':
- return U"SYRIAC LETTER MALAYALAM NNNA";
- case U'\u0866':
- return U"SYRIAC LETTER MALAYALAM BHA";
- case U'\u0867':
- return U"SYRIAC LETTER MALAYALAM RA";
- case U'\u0868':
- return U"SYRIAC LETTER MALAYALAM LLA";
- case U'\u0869':
- return U"SYRIAC LETTER MALAYALAM LLLA";
- case U'\u086A':
- return U"SYRIAC LETTER MALAYALAM SSA";
- /* RUNIC: */
- case U'\u16A0':
- return U"RUNIC LETTER FEHU FEOH FE F";
- case U'\u16A1':
- return U"RUNIC LETTER V";
- case U'\u16A2':
- return U"RUNIC LETTER URUZ UR U";
- case U'\u16A3':
- return U"RUNIC LETTER YR";
- case U'\u16A4':
- return U"RUNIC LETTER Y";
- case U'\u16A5':
- return U"RUNIC LETTER W";
- case U'\u16A6':
- return U"RUNIC LETTER THURISAZ THURS THORN";
- case U'\u16A7':
- return U"RUNIC LETTER ETH";
- case U'\u16A8':
- return U"RUNIC LETTER ANSUZ A";
- case U'\u16A9':
- return U"RUNIC LETTER OS O";
- case U'\u16AA':
- return U"RUNIC LETTER AC A";
- case U'\u16AB':
- return U"RUNIC LETTER AESC";
- case U'\u16AC':
- return U"RUNIC LETTER LONG-BRANCHED-OSS O";
- case U'\u16AD':
- return U"RUNIC LETTER SHORT-TWIG-OSS O";
- case U'\u16AE':
- return U"RUNIC LETTER O";
- case U'\u16AF':
- return U"RUNIC LETTER OE";
- case U'\u16B0':
- return U"RUNIC LETTER ON";
- case U'\u16C0':
- return U"RUNIC LETTER DOTTED-N";
- case U'\u16D0':
- return U"RUNIC LETTER SHORT-TWIG-TYR T";
- case U'\u16E0':
- return U"RUNIC LETTER EAR";
- case U'\u16F0':
- return U"RUNIC BELGTHOR SYMBOL";
- /* CYRILLIC EXTENDED C: */
- case U'\u1C80':
- return U"CYRILLIC SMALL LETTER ROUNDED VE";
- case U'\u1C81':
- return U"CYRILLIC SMALL LETTER LONG-LEGGED DE";
- case U'\u1C82':
- return U"CYRILLIC SMALL LETTER NARROW O";
- case U'\u1C83':
- return U"CYRILLIC SMALL LETTER WIDE ES";
- case U'\u1C84':
- return U"CYRILLIC SMALL LETTER TALL TE";
- case U'\u1C85':
- return U"CYRILLIC SMALL LETTER THREE-LEGGED TE";
- case U'\u1C86':
- return U"CYRILLIC SMALL LETTER TALL HARD SIGN";
- case U'\u1C87':
- return U"CYRILLIC SMALL LETTER TALL YAT";
- case U'\u1C88':
- return U"CYRILLIC SMALL LETTER UNBLENDED UK";
- /* GENERAL PUNCTUATION: */
- case U'\u2000':
- return U"EN QUAD";
- case U'\u2001':
- return U"EM QUAD";
- case U'\u2002':
- return U"EN SPACE";
- case U'\u2003':
- return U"EM SPACE";
- case U'\u2004':
- return U"THREE-PER-EM SPACE";
- case U'\u2005':
- return U"FOUR-PER-EM SPACE";
- case U'\u2006':
- return U"SIX-PER-EM SPACE";
- case U'\u2007':
- return U"FIGURE SPACE";
- case U'\u2008':
- return U"PUNCTUATION SPACE";
- case U'\u2009':
- return U"THIN SPACE";
- case U'\u200A':
- return U"HAIR SPACE";
- case U'\u203C':
- return U"DOUBLE EXCLAMATION MARK";
- case U'\u2047':
- return U"DOUBLE QUOTATION MARK";
- case U'\u2048':
- return U"QUESTION EXCLAMATION MARK";
- case U'\u2049':
- return U"EXCLAMATION QUESTION MARK";
- /* CURRENCY SYMBOLS: */
- case U'\u20A0':
- return U"EURO-CURRENCY SIGN";
- case U'\u20A1':
- return U"COLON SIGN";
- case U'\u20A2':
- return U"CRUZEIRO SIGN";
- case U'\u20A3':
- return U"FRENCH FRANC SIGN";
- case U'\u20A4':
- return U"LIRA SIGN";
- case U'\u20A5':
- return U"MILL SIGN";
- case U'\u20A6':
- return U"NAIRA SIGN";
- case U'\u20A7':
- return U"PESETA SIGN";
- case U'\u20A8':
- return U"RUPEE SIGN";
- case U'\u20A9':
- return U"WON SIGN";
- case U'\u20AA':
- return U"NEW SHEQEL SIGN";
- case U'\u20AB':
- return U"DONG SIGN";
- case U'\u20AC':
- return U"EURO SIGN";
- case U'\u20AD':
- return U"KIP SIGN";
- case U'\u20AE':
- return U"TUGRIK SIGN";
- case U'\u20AF':
- return U"DRACHMA SIGN";
- case U'\u20B0':
- return U"GERMAN PENNY SIGN";
- case U'\u20B1':
- return U"PESO SIGN";
- case U'\u20B2':
- return U"GUARANI SIGN";
- case U'\u20B3':
- return U"AUSTRAL SIGN";
- case U'\u20B4':
- return U"HRYVNIA SIGN";
- case U'\u20B5':
- return U"CEDI SIGN";
- case U'\u20B6':
- return U"LIVRE TOURNOIS SIGN";
- case U'\u20B7':
- return U"SPESMILO SIGN";
- case U'\u20B8':
- return U"TENGE SIGN";
- case U'\u20BA':
- return U"TURKISH LIRA SIGN";
- case U'\u20BB':
- return U"NORDIC MARK SIGN";
- case U'\u20BC':
- return U"MANAT SIGN";
- case U'\u20BD':
- return U"RUBLE SYMBOL";
- case U'\u20BE':
- return U"LARI SIGN";
- case U'\u20BF':
- return U"BITCOIN SIGN";
- /* LETTERLIKE SYMBOLS: */
- case U'\u2100':
- return U"ACCOUNT OF";
- case U'\u2101':
- return U"ADRESSED TO THE SUBJECT";
- case U'\u2102':
- return U"DOUBLE-STRUCK CAPITAL C";
- case U'\u2103':
- return U"DEGREE CELSIUS";
- case U'\u2104':
- return U"CENTRE LINE SYMBOL";
- case U'\u2105':
- return U"CARE OF";
- case U'\u2106':
- return U"CADA UNA";
- case U'\u2107':
- return U"EULER CONSTANT";
- case U'\u2108':
- return U"SCRUPLE";
- case U'\u2109':
- return U"DEGREE FAHRENHEIT";
- case U'\u210A':
- return U"SCRIPT SMALL G";
- case U'\u210B':
- return U"SCRIPT CAPITAL H";
- case U'\u210C':
- return U"BLACK-LETTER CAPITAL H";
- case U'\u210D':
- return U"DOUBLE-STRUCK CAPITAL H";
- case U'\u210E':
- return U"PLANCK CONSTANT";
- case U'\u210F':
- return U"PLANCK CONSTANT OVER TWO PI";
- case U'\u2110':
- return U"SCRIPT CAPITAL I";
- case U'\u2111':
- return U"BLACK-LETTER CAPITAL I";
- case U'\u2112':
- return U"SCRIPT CAPITAL L";
- case U'\u2113':
- return U"SCRIPT SMALL L";
- case U'\u2114':
- return U"L B BAR SYMBOL";
- case U'\u2115':
- return U"DOUBLE-STRUCK CAPITAL N";
- case U'\u2116':
- return U"NUMERO SIGN";
- case U'\u2117':
- return U"SOUND RECORDING COPYRIGHT";
- case U'\u2118':
- return U"SCRIPT CAPITAL P";
- case U'\u2119':
- return U"DOUBLE-STRUCK CAPITAL P";
- case U'\u211A':
- return U"DOUBLE-STRUCK CAPITAL Q";
- case U'\u211B':
- return U"SCRIPT CAPITAL R";
- case U'\u211C':
- return U"BLACK-LETTER CAPITAL R";
- case U'\u211D':
- return U"DOUBLE-STRUCK CAPITAL R";
- case U'\u211E':
- return U"PRESCRIPTION TAKE";
- case U'\u211F':
- return U"RESPONSE";
- case U'\u2120':
- return U"SERVICE MARK";
- case U'\u2121':
- return U"TELEPHONE SIGN";
- case U'\u2122':
- return U"TRADE MARK SIGN";
- case U'\u2123':
- return U"VERSICLE";
- case U'\u2124':
- return U"DOUBLE-STRUCK CAPITAL Z";
- case U'\u2125':
- return U"OUNCE SIGN";
- case U'\u2126':
- return U"OHM SIGN";
- case U'\u2127':
- return U"INVERTED OHM SIGN";
- case U'\u2128':
- return U"BLACK-LETTER CAPITAL Z";
- case U'\u2129':
- return U"TURNED GREEK SMALL LETTER IOTA";
- case U'\u212A':
- return U"KELVIN SIGN";
- case U'\u212B':
- return U"ANGSTROM SIGN";
- case U'\u212C':
- return U"SCRIPT CAPITAL B";
- case U'\u212D':
- return U"BLACK-LETTER CAPITAL C";
- case U'\u212E':
- return U"ESTIMATED SYMBOL";
- case U'\u212F':
- return U"SCRIPT SMALL E";
- case U'\u2130':
- return U"SCRIPT CAPITAL E";
- case U'\u2131':
- return U"SCRIPT CAPITAL F";
- case U'\u2132':
- return U"TURNED CAPITAL F";
- case U'\u2133':
- return U"SCRIPT CAPITAL M";
- case U'\u2134':
- return U"SCRIPT SMALL O";
- case U'\u2135':
- return U"ALEF SYMBOL";
- case U'\u2136':
- return U"BET SYMBOL";
- case U'\u2137':
- return U"GIMEL SYMBOL";
- case U'\u2138':
- return U"DALET SYMBOL";
- case U'\u2139':
- return U"INFORMATION SOURCE";
- case U'\u213A':
- return U"ROTATED CAPITAL Q";
- case U'\u213B':
- return U"FACSIMILE SIGN";
- case U'\u213C':
- return U"DOUBLE-STRUCK SMALL PI";
- case U'\u213D':
- return U"DOUBLE-STRUCK SMALL GAMMA";
- case U'\u213E':
- return U"DOUBLE-STRUCK CAPITAL GAMMA";
- case U'\u213F':
- return U"DOUBLE-STRUCK CAPITAL PI";
- case U'\u2140':
- return U"DOUBLE-STRUCK N-ARY SUMMATION";
- case U'\u2141':
- return U"TURNED SANS-SERIF CAPITAL G";
- case U'\u2142':
- return U"TURNED SANS-SERIF CAPITAL L";
- case U'\u2143':
- return U"REVERSED SANS-SERIF CAPITAL L";
- case U'\u2144':
- return U"TURNED SANS-SERIF CAPITAL Y";
- case U'\u2145':
- return U"DOUBLE-STRUCK ITALIC CAPITAL D";
- case U'\u2146':
- return U"DOUBLE-STRUCK ITALIC SMALL D";
- case U'\u2147':
- return U"DOUBLE-STRUCK ITALIC SMALL E";
- case U'\u2148':
- return U"DOUBLE-STRUCK ITALIC SMALL I";
- case U'\u2149':
- return U"DOUBLE-STRUCK ITALIC SMALL J";
- case U'\u214A':
- return U"PROPERTY LINE";
- case U'\u214B':
- return U"TURNED AMPERSAND";
- case U'\u214C':
- return U"PER SIGN";
- case U'\u214D':
- return U"AKTIESELSKAB";
- case U'\u214E':
- return U"TURNED SMALL F";
- case U'\u214F':
- return U"SYMBOL FOR SAMARITAN SOURCE";
- /* NUMBER FORMS: */
- case U'\u2150':
- return U"VULGAR FRACTION ONE SEVENTH";
- case U'\u2151':
- return U"VULGAR FRACTION ONE NINTH";
- case U'\u2152':
- return U"VULGAR FRACTION ONE TENTH";
- case U'\u2153':
- return U"VULGAR FRACTION ONE THIRD";
- case U'\u2154':
- return U"VULGAR FRACTION TWO THIRDS";
- case U'\u2155':
- return U"VULGAR FRACTION ONE FIFTH";
- case U'\u2156':
- return U"VULGAR FRACTION TWO FIFTHS";
- case U'\u2157':
- return U"VULGAR FRACTION THREE FIFTHS";
- case U'\u2158':
- return U"VULGAR FRACTION FOUR FIFTHS";
- case U'\u2159':
- return U"VULGAR FRACTION ONE SIXTH";
- case U'\u215A':
- return U"VULGAR FRACTION FIVE SIXTHS";
- case U'\u215B':
- return U"VULGAR FRACTION ONE EIGTH";
- case U'\u215C':
- return U"VULGAR FRACTION THREE EIGTHS";
- case U'\u215D':
- return U"VULGAR FRACTION FIVE EIGHTS";
- case U'\u215E':
- return U"VULGAR FRACTION SEVEN EIGTHS";
- case U'\u215F':
- return U"FRACTION NUMERATOR ONE";
- case U'\u2160':
- return U"ROMAN NUMERAL ONE";
- case U'\u2161':
- return U"ROMAN NUMERAL TWO";
- case U'\u2162':
- return U"ROMAN NUMERAL THREE";
- case U'\u2163':
- return U"ROMAN NUMERAL FOUR";
- case U'\u2164':
- return U"ROMAN NUMERAL FIVE";
- case U'\u2165':
- return U"ROMAN NUMERAL SIX";
- case U'\u2166':
- return U"ROMAN NUMERAL SEVEN";
- case U'\u2167':
- return U"ROMAN NUMERAL EIGHT";
- case U'\u2168':
- return U"ROMAN NUMERAL NINE";
- case U'\u2169':
- return U"ROMAN NUMERAL TEN";
- case U'\u216A':
- return U"ROMAN NUMERAL ELEVEN";
- case U'\u216B':
- return U"ROMAN NUMERAL TWELVE";
- case U'\u216C':
- return U"ROMAN NUMERAL FIFTY";
- case U'\u216D':
- return U"ROMAN NUMERAL ONE HUNDRED";
- case U'\u216E':
- return U"ROMAN NUMERAL FIVE HUNDRED";
- case U'\u216F':
- return U"ROMAN NUMERAL ONE THOUSAND";
- case U'\u2170':
- return U"SMALL ROMAN NUMERAL ONE";
- case U'\u2171':
- return U"SMALL ROMAN NUMERAL TWO";
- case U'\u2172':
- return U"SMALL ROMAN NUMERAL THREE";
- case U'\u2173':
- return U"SMALL ROMAN NUMERAL FOUR";
- case U'\u2174':
- return U"SMALL ROMAN NUMERAL FIVE";
- case U'\u2175':
- return U"SMALL ROMAN NUMERAL SIX";
- case U'\u2176':
- return U"SMALL ROMAN NUMERAL SEVEN";
- case U'\u2177':
- return U"SMALL ROMAN NUMERAL EIGHT";
- case U'\u2178':
- return U"SMALL ROMAN NUMERAL NINE";
- case U'\u2179':
- return U"SMALL ROMAN NUMERAL TEN";
- case U'\u217A':
- return U"SMALL ROMAN NUMERAL ELEVEN";
- case U'\u217B':
- return U"SMALL ROMAN NUMERAL TWELVE";
- case U'\u217C':
- return U"SMALL ROMAN NUMERAL FIFTY";
- case U'\u217D':
- return U"SMALL ROMAN NUMERAL ONE HUNDRED";
- case U'\u217E':
- return U"SMALL ROMAN NUMERAL FIVE HUNDRED";
- case U'\u217F':
- return U"SMALL ROMAN NUMERAL ONE THOUSAND";
- case U'\u2180':
- return U"ROMAN NUMERAL ONE THOUSAND C D";
- case U'\u2181':
- return U"ROMAN NUMERAL FIVE THOUSAND";
- case U'\u2182':
- return U"ROMAN NUMERAL TEN THOUSAND";
- case U'\u2183':
- return U"ROMAN NUMERAL REVERSED ONE HUNDRED";
- case U'\u2184':
- return U"LATIN SMALL LETTER REVERSED C";
- case U'\u2185':
- return U"ROMAN NUMERAL SIX LATE FORM";
- case U'\u2186':
- return U"ROMAN NUMERAL FIFTY EARLY FORM";
- case U'\u2187':
- return U"ROMAN NUMERAL FIFTY THOUSAND";
- case U'\u2188':
- return U"ROMAN NUMERAL ONE HUNDRED THOUSAND";
- case U'\u2189':
- return U"VULGAR FRACTION ZERO THIRDS";
- case U'\u218A':
- return U"TURNED DIGIT TWO";
- case U'\u218B':
- return U"TURNED DIGIT THREE";
- /* MISCELLANEOUS SYMBOLS: */
- case U'\u2630':
- return U"TRIGRAM FOR HEAVEN";
- case U'\u2631':
- return U"TRIGRAM FOR LAKE";
- case U'\u2632':
- return U"TRIGRAM FOR FIRE";
- case U'\u2633':
- return U"TRIGRAM FOR THUNDER";
- case U'\u2634':
- return U"TRIGRAM FOR WIND";
- case U'\u2635':
- return U"TRIGRAM FOR WATER";
- case U'\u2636':
- return U"TRIGRAM FOR MOUNTAIN";
- case U'\u2637':
- return U"TRIGRAM FOR EARTH";
- case U'\u2638':
- return U"WHEEL OF DHARMA";
- case U'\u2639':
- return U"WHITE FROWNING FACE";
- case U'\u263A':
- return U"WHITE SMILING FACE";
- case U'\u263B':
- return U"BLACK SMILING FACE";
- case U'\u263C':
- return U"WHITE SUN WITH RAYS";
- case U'\u263D':
- return U"FIRST QUARTER MOON";
- case U'\u263E':
- return U"LAST QUARTER MOON";
- case U'\u263F':
- return U"MERCURY";
- case U'\u2640':
- return U"FEMALE SIGN";
- case U'\u2641':
- return U"EARTH";
- case U'\u2642':
- return U"MALE SIGN";
- case U'\u2643':
- return U"JUPITER";
- case U'\u2644':
- return U"SATURN";
- case U'\u2645':
- return U"URANUS";
- case U'\u2646':
- return U"NEPTUNE";
- case U'\u2647':
- return U"PLUTO";
- case U'\u2648':
- return U"ARIES";
- case U'\u2649':
- return U"TAURUS";
- case U'\u264A':
- return U"GEMNINI";
- case U'\u264B':
- return U"CANCER";
- case U'\u264C':
- return U"LEO";
- case U'\u264D':
- return U"VIRGO";
- case U'\u264E':
- return U"LIBRA";
- case U'\u264F':
- return U"SCORPIUS";
- case U'\u2650':
- return U"SAGITTARIUS";
- case U'\u2651':
- return U"CAPRICORN";
- case U'\u2652':
- return U"AQUARIUS";
- case U'\u2653':
- return U"PISCES";
- case U'\u2654':
- return U"WHITE CHESS KING";
- case U'\u2655':
- return U"WHITE CHESS QUEEN";
- case U'\u2656':
- return U"WHITE CHESS ROOK";
- case U'\u2657':
- return U"WHITE CHESS BISHOP";
- case U'\u2658':
- return U"WHITE CHESS KNIGHT";
- case U'\u2659':
- return U"WHITE CHESS PAWN";
- case U'\u265A':
- return U"BLACK CHESS KING";
- case U'\u265B':
- return U"BLACK CHESS QUEEN";
- case U'\u265C':
- return U"BLACK CHESS ROOK";
- case U'\u265D':
- return U"BLACK CHESS BISHOP";
- case U'\u265E':
- return U"BLACK CHESS KNIGHT";
- case U'\u265F':
- return U"BLACK CHESS PAWN";
- case U'\u2660':
- return U"BLACK SPADE SUIT";
- case U'\u2661':
- return U"WHITE HEART SUIT";
- case U'\u2662':
- return U"WHITE DIAMOND SUIT";
- case U'\u2663':
- return U"BLACK CLUB SUIT";
- case U'\u2664':
- return U"WHITE SPADE SUIT";
- case U'\u2665':
- return U"BLACK HEART SUIT";
- case U'\u2666':
- return U"BLACK DIAMOND SUIT";
- case U'\u2667':
- return U"WHITE CLUB SUIT";
- case U'\u2668':
- return U"HOT SPRINGS";
- case U'\u2669':
- return U"QUARTER NOTE";
- case U'\u266A':
- return U"EIGHT NOTE";
- case U'\u266B':
- return U"BEAMED EIGTH NOTES";
- case U'\u266C':
- return U"BEAMED SIXTEENTH NOTES";
- case U'\u266D':
- return U"MUSIC FLAT SIGN";
- case U'\u266E':
- return U"MUSIC NEUTRAL SIGN";
- case U'\u266F':
- return U"MUSIC SHARP SIGN";
- case U'\u2670':
- return U"WEST SYRIAC CROSS";
- case U'\u2671':
- return U"EAST SYRIAC CROSS";
- case U'\u2672':
- return U"UNIVERSAL RECYCLING SYMBOL";
- case U'\u2673':
- return U"RECYCLING SYMBOL FOR TYPE-1 PLASTICS";
- case U'\u2674':
- return U"RECYCLING SYMBOL FOR TYPE-2 PLASTICS";
- case U'\u2675':
- return U"RECYCLING SYMBOL FOR TYPE-3 PLASTICS";
- case U'\u2676':
- return U"RECYCLING SYMBOL FOR TYPE-4 PLASTICS";
- case U'\u2677':
- return U"RECYCLING SYMBOL FOR TYPE-5 PLASTICS";
- case U'\u2678':
- return U"RECYCLING SYMBOL FOR TYPE-6 PLASTICS";
- case U'\u2679':
- return U"RECYCLING SYMBOL FOR TYPE-7 PLASTICS";
- case U'\u267A':
- return U"RECYCLING SYMBOL FOR GENERIC MATERIALS";
- case U'\u267B':
- return U"BLACK UNIVERSAL RECYCLING SYMBOL";
- case U'\u267C':
- return U"RECYCLED PAPER SYMBOL";
- case U'\u267D':
- return U"PARTIALLY-RECYCLED PAPER SYMBOL";
- case U'\u267E':
- return U"PERMANENT PAPER SIGN";
- case U'\u267F':
- return U"WHEELCHAIR SYMBOL";
- case U'\u26B9':
- return U"SEXTILE";
- /* DINGBATS: */
- case U'\u271D':
- return U"LATIN CROSS";
- case U'\u2721':
- return U"STAR OF DAVID";
- /* SUPPLEMENTAL PUNCTUATION: */
- case U'\u2E3B':
- return U"THREE-EM DASH";
- /* ARABIC PRESENTATION FORMS-A: */
- case U'\uFDFD':
- return U"ARABIC LIGATURE BISMILLAH AL-RAHMAN AR-RAHEEM";
- /* ANCIENT SYMBOLS: */
- case U'\U00010190':
- return U"ROMAN SEXTANS SIGN";
- case U'\U00010191':
- return U"ROMAN UNCIA SIGN";
- case U'\U00010192':
- return U"ROMAN SEMUNCIA SIGN";
- case U'\U00010193':
- return U"ROMAN SEXTULA SIGN";
- case U'\U00010194':
- return U"ROMAN DIMIDIA SEXTULA SIGN";
- case U'\U00010195':
- return U"ROMAN SILIQUA SIGN";
- case U'\U00010196':
- return U"ROMAN DENARIUS SIGN";
- case U'\U00010197':
- return U"ROMAN QUINARIUS SIGN";
- case U'\U00010198':
- return U"ROMAN SESTERTIUS SIGN";
- case U'\U00010199':
- return U"ROMAN DUPONDIUS SIGN";
- case U'\U0001019A':
- return U"ROMAN AS SIGN";
- case U'\U0001019B':
- return U"ROMAN CENTURIAL SIGN";
- case U'\U0001019C':
- return U"ASCIA SIGN";
- /* BRAHMI: */
- case U'\U00011066':
- return U"BRAHMI DIGIT ZERO";
- case U'\U00011067':
- return U"BRAHMI DIGIT ONE";
- case U'\U00011068':
- return U"BRAHMI DIGIT TWO";
- case U'\U00011069':
- return U"BRAHMI DIGIT THREE";
- case U'\U0001106A':
- return U"BRAHMI DIGIT FOUR";
- case U'\U0001106B':
- return U"BRAHMI DIGIT FIVE";
- case U'\U0001106C':
- return U"BRAHMI DIGIT SIX";
- case U'\U0001106D':
- return U"BRAHMI DIGIT SEVEN";
- case U'\U0001106E':
- return U"BRAHMI DIGIT EIGHT";
- case U'\U0001106F':
- return U"BRAHMI DIGIT NINE";
- /* CUNEIFORM: */
- case U'\U00012031':
- return U"CUNEIFORM SIGN AN PLUS NAGA SQUARED";
- /* CUNEIFORM NUMBERS AND PUNCTUATION: */
- case U'\U0001242B':
- return U"CUNEIFORM NUMERIC SIGN NINE SHAR2";
- /* EGYPTIAN HIEROGLYPHS: */
- case U'\U000130B8':
- return U"EGYPTIAN HIEROGLYPH D052";
- /* COUNTING ROD NUMERALS: */
- case U'\U0001D372':
- return U"IDEOGRAPHIC TALLY MARK ONE";
- case U'\U0001D373':
- return U"IDEOGRAPHIC TALLY MARK TWO";
- case U'\U0001D374':
- return U"IDEOGRAPHIC TALLY MARK THREE";
- case U'\U0001D375':
- return U"IDEOGRAPHIC TALLY MARK FOUR";
- case U'\U0001D376':
- return U"IDEOGRAPHIC TALLY MARK FIVE";
- case U'\U0001D377':
- return U"TALLY MARK ONE";
- case U'\U0001D378':
- return U"TALLY MARK FIVE";
- /* ENCLOSED ALPHANUMERIC SUPPLEMENT: */
- case U'\U0001F10D':
- return U"CIRCLED ZERO WITH SLASH";
- case U'\U0001F10E':
- return U"CIRCLED ANTICKLOCKWISE ARROW";
- case U'\U0001F10F':
- return U"CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH";
- case U'\U0001F12F':
- return U"COPYLEFT SYMBOL";
- case U'\U0001F16D':
- return U"CIRCLED CC";
- case U'\U0001F16E':
- return U"CIRCLED C WITH OVERLAID BACKSLASH";
- case U'\U0001F16F':
- return U"CIRCLED HUMAN FIGURE";
- /* EMOTICONS: */
- case U'\U0001F600':
- return U"GRINNING FACE";
- case U'\U0001F601':
- return U"GRINNING FACE WITH SMIRKING EYES";
- case U'\U0001F602':
- return U"FACE WITH TEARS OF JOY";
- case U'\U0001F603':
- return U"SMILING FACE WITH OPEN MOUTH";
- case U'\U0001F604':
- return U"SMILING FACE WITH OPEN MOUTH AND SMILING EYES";
- case U'\U0001F605':
- return U"SMILING FACE WITH OPEN MOUTH AND COULD SWEAT";
- case U'\U0001F606':
- return U"SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES";
- case U'\U0001F607':
- return U"SMILING FACE WITH HALO";
- case U'\U0001F608':
- return U"SMILING FACE WITH HORNS";
- case U'\U0001F609':
- return U"WINKING FACE";
- case U'\U0001F60A':
- return U"SMILING FACE WITH SMILING EYES";
- case U'\U0001F60B':
- return U"FACE SAVOURING DELICIOUS FOOD";
- case U'\U0001F60C':
- return U"RELIEVED FACE";
- case U'\U0001F60D':
- return U"SMILLING FACE HEART-SHAPED EYES";
- case U'\U0001F60E':
- return U"SMILLING FACE WITH SUNGLASSES";
- case U'\U0001F60F':
- return U"SMIRKING FACE";
- case U'\U0001F610':
- return U"NEUTRAL FACE";
- case U'\U0001F611':
- return U"EXPRESSIONLESS FACE";
- case U'\U0001F612':
- return U"UNAMUSED FACE";
- case U'\U0001F613':
- return U"FACE WITH COLD SWEAT";
- case U'\U0001F614':
- return U"PENSIVE FACE";
- case U'\U0001F615':
- return U"CONFUSED FACE";
- case U'\U0001F616':
- return U"CONFOUNDED FACE";
- case U'\U0001F617':
- return U"KISSING FACE";
- case U'\U0001F618':
- return U"FACE THROWING A KISS";
- case U'\U0001F619':
- return U"KISSING FACE WITH SMILLING EYES";
- case U'\U0001F61A':
- return U"KISSING FACE WITH CLOSED EYES";
- case U'\U0001F61B':
- return U"FACE WITH STUCK-OUT TONGUE";
- case U'\U0001F61C':
- return U"FACE WITH STUCK-OUT TONGUE AND WINKING EYE";
- case U'\U0001F61D':
- return U"FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES";
- case U'\U0001F61E':
- return U"DISSAPOINTED FACE";
- case U'\U0001F61F':
- return U"WORRIED FACE";
- case U'\U0001F620':
- return U"ANGRY FACE";
- case U'\U0001F621':
- return U"POUTING FACE";
- case U'\U0001F622':
- return U"CRYING FACE";
- case U'\U0001F623':
- return U"PERSEVERING FACE";
- case U'\U0001F624':
- return U"FACE WITH LOOK OF TRIUMPH";
- case U'\U0001F625':
- return U"DISSAPOINTED BUT RELIEVED FACE";
- case U'\U0001F626':
- return U"FROWNING FACE WITH OPEN MOUTH";
- case U'\U0001F627':
- return U"ANGUISHED FACE";
- case U'\U0001F628':
- return U"FEARFUL FACE";
- case U'\U0001F629':
- return U"WEARY FACE";
- case U'\U0001F62A':
- return U"SLEEPY FACE";
- case U'\U0001F62B':
- return U"TIRED FACE";
- case U'\U0001F62C':
- return U"GRIMACING FACE";
- case U'\U0001F62D':
- return U"LOUDLY CRYING FACE";
- case U'\U0001F62E':
- return U"FACE WITH OPEN MOUTH";
- case U'\U0001F62F':
- return U"HUSHED FACE";
- case U'\U0001F630':
- return U"FACE WITH OPEN MOUTH AND COLD SWEAT";
- case U'\U0001F631':
- return U"FACE SCREAMING IN FEAR";
- case U'\U0001F632':
- return U"ASTONISHED FACE";
- case U'\U0001F633':
- return U"FLUSHED FACE";
- case U'\U0001F634':
- return U"SLEEPING FACE";
- case U'\U0001F635':
- return U"DIZZY FACE";
- case U'\U0001F636':
- return U"FACE WITHOUT MOUTH";
- case U'\U0001F637':
- return U"FACE WITH MEDICAL MASK";
- case U'\U0001F641':
- return U"SLIGHTLY FROWNING FACE";
- case U'\U0001F642':
- return U"SLIGHTLY SMILING FACE";
- case U'\U0001F643':
- return U"UPSIDE-DOWN FACE";
- case U'\U0001F644':
- return U"FACE WITH ROLLING EYES";
- /* ORNAMENTAL DINGBATS: */
- case U'\U0001F670':
- return U"SCRIPT LIGATURE ET ORNAMENT";
- case U'\U0001F671':
- return U"HEAVY SCRIPT LIGATURE ET ORNAMENT";
- case U'\U0001F672':
- return U"LIGATURE OPEN ET ORNAMENT";
- case U'\U0001F673':
- return U"HEAVY LIGATURE OPEN ET ORNAMENT";
- case U'\U0001F674':
- return U"HEAVY AMPERSAND ORNAMENT";
- case U'\U0001F675':
- return U"SWASH AMPERSAND ORNAMENT";
- case U'\U0001F676':
- return U"SANS-SERIF HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT";
- case U'\U0001F677':
- return U"SANS-SERIF HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT";
- case U'\U0001F678':
- return U"SANS-SERIF HEAVY LOW DOUBLE QUOTATION MARK ORNAMENT";
- case U'\U0001F679':
- return U"HEAVY INTERROBANG ORNAMENT";
- case U'\U0001F67A':
- return U"SANS-SERIF INTERROBANG ORNAMENT";
- case U'\U0001F67B':
- return U"HEAVY SANS-SERIF INTERROBANG ORNAMENT";
- case U'\U0001F67C':
- return U"VERY HEAVY SOLIDUS";
- case U'\U0001F67D':
- return U"VERY HEAVY REVERSE SOLIDUS";
- case U'\U0001F67E':
- return U"CHECKER BOARD";
- case U'\U0001F67F':
- return U"REVERSE CHECKER BOARD";
- /* CJK UNIFIED IDEOGRAPHS EXTENSION G: */
- case U'\U0003106C':
- return U"CJK UNIFIED IDEOGRAPH-3106C";
- /* TAGS: */
- case U'\U000E0001':
- return U"LANGUAGE TAG";
- case U'\U000E0020':
- return U"TAG SPACE";
- case U'\U000E0021':
- return U"TAG EXCLAMATION MARK";
- case U'\U000E0022':
- return U"TAG QUOTATION MARK";
- case U'\U000E0023':
- return U"TAG NUMBER SIGN";
- case U'\U000E0024':
- return U"TAG DOLLAR SIGN";
- case U'\U000E0025':
- return U"TAG PERCENT SIGN";
- case U'\U000E0026':
- return U"TAG AMPERSAND";
- case U'\U000E0027':
- return U"TAG APOSTROPHE";
- case U'\U000E0028':
- return U"TAG LEFT PARANTHESIS";
- case U'\U000E0029':
- return U"TAG RIGHT PARANTHESIS";
- case U'\U000E002A':
- return U"TAG ASTERISK";
- case U'\U000E002B':
- return U"TAG PLUS SIGN";
- case U'\U000E002C':
- return U"TAG COMMA";
- case U'\U000E002D':
- return U"TAG HYPHEN-MINUS";
- case U'\U000E002E':
- return U"TAG FULL STOP";
- case U'\U000E002F':
- return U"TAG SOLIDUS";
- case U'\U000E0030':
- return U"TAG DIGIT ZERO";
- case U'\U000E0031':
- return U"TAG DIGIT ONE";
- case U'\U000E0032':
- return U"TAG DIGIT TWO";
- case U'\U000E0033':
- return U"TAG DIGIT THREE";
- case U'\U000E0034':
- return U"TAG DIGIT FOUR";
- case U'\U000E0035':
- return U"TAG DIGIT FIVE";
- case U'\U000E0036':
- return U"TAG DIGIT SIX";
- case U'\U000E0037':
- return U"TAG DIGIT SEVEN";
- case U'\U000E0038':
- return U"TAG DIGIT EIGHT";
- case U'\U000E0039':
- return U"TAG DIGIT NINE";
- case U'\U000E003A':
- return U"TAG COLON";
- case U'\U000E003B':
- return U"TAG SEMICOLON";
- case U'\U000E003C':
- return U"TAG LESS-THAN SIGN";
- case U'\U000E003D':
- return U"TAG EQUALS SIGN";
- case U'\U000E003E':
- return U"TAG GREATER-THAN SIGN";
- case U'\U000E003F':
- return U"TAG QUESTION MARK";
- case U'\U000E0040':
- return U"TAG COMMERCIAL AT";
- case U'\U000E0041':
- return U"TAG LATIN CAPITAL LETTER A";
- case U'\U000E0042':
- return U"TAG LATIN CAPITAL LETTER B";
- case U'\U000E0043':
- return U"TAG LATIN CAPITAL LETTER C";
- case U'\U000E0044':
- return U"TAG LATIN CAPITAL LETTER D";
- case U'\U000E0045':
- return U"TAG LATIN CAPITAL LETTER E";
- case U'\U000E0046':
- return U"TAG LATIN CAPITAL LETTER F";
- case U'\U000E0047':
- return U"TAG LATIN CAPITAL LETTER G";
- case U'\U000E0048':
- return U"TAG LATIN CAPITAL LETTER H";
- case U'\U000E0049':
- return U"TAG LATIN CAPITAL LETTER I";
- case U'\U000E004A':
- return U"TAG LATIN CAPITAL LETTER J";
- case U'\U000E004B':
- return U"TAG LATIN CAPITAL LETTER K";
- case U'\U000E004C':
- return U"TAG LATIN CAPITAL LETTER L";
- case U'\U000E004D':
- return U"TAG LATIN CAPITAL LETTER M";
- case U'\U000E004E':
- return U"TAG LATIN CAPITAL LETTER N";
- case U'\U000E004F':
- return U"TAG LATIN CAPITAL LETTER O";
- case U'\U000E0050':
- return U"TAG LATIN CAPITAL LETTER P";
- case U'\U000E0051':
- return U"TAG LATIN CAPITAL LETTER Q";
- case U'\U000E0052':
- return U"TAG LATIN CAPITAL LETTER R";
- case U'\U000E0053':
- return U"TAG LATIN CAPITAL LETTER S";
- case U'\U000E0054':
- return U"TAG LATIN CAPITAL LETTER T";
- case U'\U000E0055':
- return U"TAG LATIN CAPITAL LETTER U";
- case U'\U000E0056':
- return U"TAG LATIN CAPITAL LETTER V";
- case U'\U000E0057':
- return U"TAG LATIN CAPITAL LETTER W";
- case U'\U000E0058':
- return U"TAG LATIN CAPITAL LETTER X";
- case U'\U000E0059':
- return U"TAG LATIN CAPITAL LETTER Y";
- case U'\U000E005A':
- return U"TAG LATIN CAPITAL LETTER Z";
- case U'\U000E005B':
- return U"TAG LEFT SQUARE BRACKET";
- case U'\U000E005C':
- return U"TAG REVERSE SOLIDUS";
- case U'\U000E005D':
- return U"TAG RIGHT SQUARE BRACKET";
- case U'\U000E005E':
- return U"TAG CIRCUMFLEX ACCENT";
- case U'\U000E005F':
- return U"TAG LOW LINE";
- case U'\U000E0060':
- return U"TAG GRAVE ACCENT";
- case U'\U000E0061':
- return U"TAG LATIN SMALL LETTER A";
- case U'\U000E0062':
- return U"TAG LATIN SMALL LETTER B";
- case U'\U000E0063':
- return U"TAG LATIN SMALL LETTER C";
- case U'\U000E0064':
- return U"TAG LATIN SMALL LETTER D";
- case U'\U000E0065':
- return U"TAG LATIN SMALL LETTER E";
- case U'\U000E0066':
- return U"TAG LATIN SMALL LETTER F";
- case U'\U000E0067':
- return U"TAG LATIN SMALL LETTER G";
- case U'\U000E0068':
- return U"TAG LATIN SMALL LETTER H";
- case U'\U000E0069':
- return U"TAG LATIN SMALL LETTER I";
- case U'\U000E006A':
- return U"TAG LATIN SMALL LETTER J";
- case U'\U000E006B':
- return U"TAG LATIN SMALL LETTER K";
- case U'\U000E006C':
- return U"TAG LATIN SMALL LETTER L";
- case U'\U000E006D':
- return U"TAG LATIN SMALL LETTER M";
- case U'\U000E006E':
- return U"TAG LATIN SMALL LETTER N";
- case U'\U000E006F':
- return U"TAG LATIN SMALL LETTER O";
- case U'\U000E0070':
- return U"TAG LATIN SMALL LETTER P";
- case U'\U000E0071':
- return U"TAG LATIN SMALL LETTER Q";
- case U'\U000E0072':
- return U"TAG LATIN SMALL LETTER R";
- case U'\U000E0073':
- return U"TAG LATIN SMALL LETTER S";
- case U'\U000E0074':
- return U"TAG LATIN SMALL LETTER T";
- case U'\U000E0075':
- return U"TAG LATIN SMALL LETTER U";
- case U'\U000E0076':
- return U"TAG LATIN SMALL LETTER V";
- case U'\U000E0077':
- return U"TAG LATIN SMALL LETTER W";
- case U'\U000E0078':
- return U"TAG LATIN SMALL LETTER X";
- case U'\U000E0079':
- return U"TAG LATIN SMALL LETTER Y";
- case U'\U000E007A':
- return U"TAG LATIN SMALL LETTER Z";
- case U'\U000E007B':
- return U"TAG LEFT CURLY BRACKET";
- case U'\U000E007C':
- return U"TAG VERTICAL LINE";
- case U'\U000E007D':
- return U"TAG RIGHT CURLY BRACKET";
- case U'\U000E007E':
- return U"TAG TILDE";
- case U'\U000E007F':
- return U"CANCEL TAG";
- }
-}
diff --git a/include/dux/str.hh b/include/dux/str.hh
deleted file mode 100644
index 6ecf0ca..0000000
--- a/include/dux/str.hh
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- class str {
- public:
- constexpr auto app( ::dux::str const & oth) -> ::dux::str const &;
- [[nodiscard]] constexpr auto begin() noexcept -> char32_t *;
- [[nodiscard]] constexpr auto begin() const noexcept -> char32_t const *;
- [[nodiscard]] constexpr auto cbegin() const noexcept -> char32_t const *;
- [[nodiscard]] constexpr auto cend() const noexcept -> char32_t const *;
- constexpr auto del( ::dux::usz pos) -> void;
- [[nodiscard]] constexpr auto end() noexcept -> char32_t *;
- [[nodiscard]] constexpr auto end() const noexcept -> char32_t const *;
- [[nodiscard]] constexpr auto fnd( char32_t chr) const noexcept -> ::dux::usz;
- constexpr auto ins( ::dux::usz pos, ::dux::str const & oth) -> ::dux::str const &;
- constexpr auto len() const noexcept -> ::dux::usz;
- constexpr auto operator + ( ::dux::str const & oth) const -> ::dux::str;
- constexpr auto operator = ( ::dux::str const & oth) -> ::dux::str const &;
- constexpr auto operator == (::dux::str const & oth) const noexcept -> bool;
- constexpr auto operator [] (::dux::usz pos) noexcept -> char32_t &;
- constexpr auto operator [] (::dux::usz pos) const noexcept -> char32_t const &;
- [[nodiscard]] constexpr str() noexcept = default;
- [[nodiscard]] constexpr str( char32_t chr);
- [[nodiscard]] constexpr str( ::dux::str const & oth);
- [[nodiscard]] constexpr str( ::dux::str && oth);
- template<::dux::usz N> [[nodiscard]] constexpr str( char const (& strlit)[N]) noexcept = delete;
- template<::dux::usz N> [[nodiscard]] constexpr str( char32_t const (& strlit)[N]) noexcept;
- template<::dux::utf T> [[nodiscard]] constexpr str( T chr);
- template<::dux::utf T> [[nodiscard]] constexpr str( T const * utf);
- [[nodiscard]] constexpr auto sub( ::dux::usz pos, ::dux::usz len) const -> ::dux::str;
- [[nodiscard]] constexpr auto u8() const -> ::dux::arr<char8_t>;
- private:
- ::dux::arr<char32_t> _arr;
- };
-
- template<::dux::utf T,::dux::utf T0> [[nodiscard]] constexpr auto cnv( T0 const * begin,T0 const * end) -> ::dux::arr<T>;
- [[nodiscard,dux_attr_const]] constexpr auto isalnum( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto isalpha( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto iscntrl( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto isdigit( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto islower( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto ispunct( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto isspace( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto issurro( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto isupper( char32_t chr) -> bool;
- [[nodiscard,dux_attr_const]] constexpr auto isxdigit(char32_t chr) -> bool;
- [[nodiscard]] constexpr auto uniblk( char32_t chr) -> ::dux::str;
- [[nodiscard]] constexpr auto uninm( char32_t chr) -> ::dux::str;
-}
-
-#include <dux/str.d/cnv.hh>
-#include <dux/str.d/isalnum.hh>
-#include <dux/str.d/isalpha.hh>
-#include <dux/str.d/iscntrl.hh>
-#include <dux/str.d/isdigit.hh>
-#include <dux/str.d/islower.hh>
-#include <dux/str.d/ispunct.hh>
-#include <dux/str.d/isspace.hh>
-#include <dux/str.d/issurro.hh>
-#include <dux/str.d/isupper.hh>
-#include <dux/str.d/isxdigit.hh>
-#include <dux/str.d/str.hh>
-#include <dux/str.d/uniblk.hh>
-#include <dux/str.d/uninm.hh>
diff --git a/include/dux/sys.d/_ass.hh b/include/dux/sys.d/_ass.hh
deleted file mode 100644
index ecb9548..0000000
--- a/include/dux/sys.d/_ass.hh
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <iostream>
-
-constexpr auto ::dux::_ass(char const * const dux_restr _fl,unsigned long const _ln,char const * const dux_restr _fn,bool const _expr,char const * const dux_restr _exprstr,char const * const dux_restr _msg) noexcept -> bool {
- if (!_expr) [[unlikely]] {
- ::std::cerr << "\n";
- ::std::cerr << "Assertion \u001B[38;2;225;61;61mfailed\u001B[0m";
- if (!::dux::cstrcmp(_msg,"")) {
- ::std::cerr << "!";
- }
- else {
- ::std::cerr << ": \u001B[3m" << _msg << "\u001B[0m";
- }
- ::std::cerr << "\n";
- ::std::cerr << "... at \u001B[38;2;225;169;61m\"" << _fl << "\"\u001B[0m:\u001B[38;2;255;169;61m" << _ln << "\u001B[0m\n";
- ::std::cerr << "... in \u001B[38;2;169;225;61m" << _fn << "\u001B[0m\n";
- ::std::cerr << " Expression (\u001B[38;2;61;169;225m" << _exprstr << "\u001B[0m) does not evaluate to true!\n";
- ::std::cerr << "\n";
- ::dux::abrt();
- }
- return _expr;
-}
diff --git a/include/dux/sys.d/dobj.hh b/include/dux/sys.d/dobj.hh
deleted file mode 100644
index 5f60b4c..0000000
--- a/include/dux/sys.d/dobj.hh
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#if defined(dux_os_posix)
-#include <dlfcn.h>
-#endif
-
-namespace dux {
- class _dobjdat {
- public:
-#if defined(dux_os_posix)
- void * dlhandl{nullptr};
-#endif
- };
-}
-
-template<typename T,typename... Ts> auto ::dux::dobj::call(char const * const dux_restr _fn,Ts const &... _args) -> T {
- [[maybe_unused]] auto const dat = static_cast<::dux::_dobjdat *>(this->_dat);
- dux_ass(_fn != nullptr,"Input C-string points to null!");
-#if defined(dux_os_posix)
- dux_ass(dat->dlhandl != nullptr,"Dynamic object has not been linked!");
- auto const sym = reinterpret_cast<T (*)(Ts...)>(::dlsym(dat->dlhandl,_fn));
- if (sym == nullptr) [[unlikely]] {
- throw ::dux::runerr("Unable to load function!");
- }
- return sym(_args...);
-#endif
-}
-::dux::dobj::dobj() : _dat(::new ::dux::_dobjdat) {
-}
-auto ::dux::dobj::link(char const * const dux_restr _lib) -> void {
- [[maybe_unused]] auto const dat = static_cast<::dux::_dobjdat *>(this->_dat);
- dux_ass(_lib != nullptr,"Input C-string points to null!");
-#if defined(dux_os_posix)
- dat->dlhandl = ::dlopen(_lib,RTLD_LOCAL | RTLD_NOW);
- if (dat->dlhandl == nullptr) [[unlikely]] {
- throw ::dux::runerr("Unable to open library!");
- }
-#endif
-}
-auto ::dux::dobj::unlink() noexcept -> void {
- [[maybe_unused]] auto const dat = static_cast<::dux::_dobjdat *>(this->_dat);
-#if defined(dux_os_posix)
- if (dat->dlhandl != nullptr) {
- ::dlclose(dat->dlhandl);
- dat->dlhandl = nullptr;
- }
-#endif
-}
-::dux::dobj::~dobj() noexcept {
- ::delete static_cast<::dux::_dobjdat *>(this->_dat);
-}
diff --git a/include/dux/sys.hh b/include/dux/sys.hh
deleted file mode 100644
index 9f34f20..0000000
--- a/include/dux/sys.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#define dux_ass(expr,msg) \
- ([&]() { \
- if constexpr (::dux::dbg) { \
- ::dux::_ass(__FILE__,static_cast<unsigned long>(__LINE__),dux_fnnm,expr,#expr,msg); \
- } \
- }())
-
-namespace dux {
- enum class sig : ::dux::ubyte {
- abrt,
- fpe,
- ill,
- int_,
- kill,
- segv,
- term,
- trap,
-#if defined(dux_os_posix)
- alrm,
- bus,
- cont,
- hup,
- iot,
- pipe,
- poll,
- prof,
- quit,
- rtmax,
- rtmin,
- stop,
- sys,
- tstp,
- ttin,
- ttou,
- urg,
- usr1,
- usr2,
- vtalrm,
- winch,
- xcpu,
- xfsz,
-#endif
- };
- constexpr auto numsig{static_cast<::dux::ubyte>([]() {
-#if defined(dux_os_posix)
- return ::dux::sig::xfsz;
-#else
- return ::dux::sig::trap;
-#endif
- }()) + ::dux::ubytev(0x1)};
-
- class dobj {
- public:
- template<typename T,typename... Ts> [[nodiscard]] inline auto call( char const * fn, Ts const &... args) -> T;
- [[nodiscard]] inline dobj();
- inline auto link( char const * lib) -> void;
- inline auto unlink() noexcept -> void;
- inline ~dobj() noexcept;
- private:
- void * const dux_restr _dat;
- };
-
- constexpr auto _ass( char const * fl, unsigned long ln, char const * fn, bool expr,char const * exprstr,char const * msg) noexcept -> bool;
- [[noreturn]] auto abrt() noexcept -> void;
- [[noreturn]] auto abrt( ::dux::str const & msg) noexcept -> void;
- [[noreturn]] auto exit( ::dux::stat stat = ::dux::stat::ok) noexcept -> void;
- [[nodiscard]] auto getenv( char const * var) -> char const *;
- [[noreturn]] auto qexit( ::dux::stat stat = ::dux::stat::err) noexcept -> void;
- auto raise( ::dux::sig sig) noexcept -> void;
- auto sighandl(::dux::sig sig, auto (* handl)(::dux::sig) -> void) -> auto (&)(::dux::sig) -> void;
- auto sleep( ::dux::uint64 sec, ::dux::uint64 nsecx = ::dux::uint64v(0x0),::dux::uint64 nsecy = ::dux::uint64v(0x1)) noexcept -> void;
- [[noreturn]] auto trap() noexcept -> void;
- [[noreturn]] auto unreach() noexcept -> void;
-
- constexpr auto (* dflsighandl)(::dux::sig) -> void {nullptr};
-}
-
-#include <dux/sys.d/_ass.hh>
-#include <dux/sys.d/dobj.hh>
diff --git a/include/dux/thrd.d/thrd.hh b/include/dux/thrd.d/thrd.hh
deleted file mode 100644
index 5f8aa29..0000000
--- a/include/dux/thrd.d/thrd.hh
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-/*
- thrd implementation:
- (To-do) On Linux, we will use our own wrappers for the Linux system calls (syscalls) that enable multithreading;
- On POSIX, we will use our own wrappers for the POSIX Threads API, as to not polute the global scope;
-*/
-
-
-namespace dux {
-#if defined(dux_os_posix)
- template<typename Fn,typename... Ts> class _thrdwrapdat {
- public:
- ::dux::tup<Ts...> args;
- Fn * fn {nullptr};
- };
-#endif
-}
-template<typename T> auto ::dux::thrd::join(T * const dux_restr _ret) -> void {
- if (this->_isjoin) [[unlikely]] { /* We do not need to do anything if the thread has joined. */
- return;
- }
-#if defined(dux_os_posix)
- auto const ret{static_cast<T *>(::dux::_pthrdjoin(this->_pthrdhandl))}; /* POSIX Threads return the pointer passed to (::pthread_exit) on joining of thread. */
- if constexpr (!::dux::isvoid<T>) { /* (void) is an incomplete type, and we do not need to operate on it. */
- if (_ret) { /* Safe: "A prvalue of integral, floating-point, unscoped enumeration, __pointer__, and pointer-to-member types can be converted to a prvalue of type bool.", cppreference, 2021-11-17T15:40:00+0100 */
- *_ret = *ret;
- }
- }
- ::delete ret; /* Free the allocated memory we got from the wrapper lambda in (::dux::thrd::operator ()). */
-#else
- _Pragma("GCC message Unable to implement (::dux::thrd::join)!");
-#endif
- this->_isjoin = true;
-}
-template<typename Fn,typename... Ts> auto ::dux::thrd::operator () (Fn const & _fn, Ts const &... _args) -> auto {
- using T = decltype(_fn(Ts{}...));
-#if defined(dux_os_posix)
- auto thrdwrap{[](void * const dux_restr _dat) -> void * { /* POSIX Threads use functions of type (void * (void *)). We will create a wrapper lambda, which calls the provided function (_fn). */
- auto const dat {static_cast<::dux::_thrdwrapdat<Fn,Ts...> *>(_dat)};
- auto const fn {dat->fn};
- auto const args{dat->args};
- ::delete dat;
- auto const ret{::new T};
- *ret = args.apply(fn);
- return ret;
- }};
- auto const thrdwrapdat{::new ::dux::_thrdwrapdat<Fn,Ts...>};
- thrdwrapdat->fn = _fn;
- thrdwrapdat->args = ::dux::tup{_args...};
- ::dux::_pthrdcrt(this->_pthrdhandl,thrdwrap,thrdwrapdat);
-#else
- _Pragma("GCC message Unable to implement (::dux::thrd::operator ())!");
-#endif
- this->_isjoin = false;
- return T{};
-}
-template<typename Fn,typename... Ts> auto ::dux::thrd::run(Fn const & _fn, Ts const &... _args) -> decltype(auto) { /* This is a wrapper for (::dux::thrd::operator ()) to be used in cases of the thread being accessed using a handle ((thrd->run(...)) is prettier than (thrc->operator () (...))). */
- return this->operator () (_fn,_args...);
-}
-#if defined(dux_os_posix)
-::dux::thrd::thrd() : _pthrdhandl(::dux::_getpthrdhandl()) {}
-#else
-::dux::thrd::thrd() {}
-#endif
-::dux::thrd::~thrd() noexcept {
- if (!this->_isjoin) [[unlikely]] { /* The programmer did not join the thread before it got out of scope. We want safe programming, so we will __not__ recover from this. */
- ::dux::abrt(U"dux :: Active thread got out of scope!");
- }
-#if defined(dux_os_posix)
- ::dux::_freepthrdhandl(this->_pthrdhandl);
-#endif
-}
diff --git a/include/dux/thrd.hh b/include/dux/thrd.hh
deleted file mode 100644
index 558b737..0000000
--- a/include/dux/thrd.hh
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-namespace dux {
- class thrderr : public ::dux::except {
- public:
- using ::dux::except::except;
- };
-
- class thrd {
- public:
- template<typename T = ::dux::ubyte> auto join( T * ret = nullptr) -> void;
- template<typename T> auto join( ::dux::nullptrtyp) = delete;
- template<typename Fn, typename... Ts> auto operator () (Fn const & fn, Ts const &... args) -> auto;
- template<typename Fn, typename... Ts> auto run( Fn const & fn, Ts const &... args) -> decltype(auto);
- [[nodiscard]] inline thrd();
- inline ~thrd() noexcept;
- private:
- bool _isjoin{true};
- void * const dux_restr _pthrdhandl;
- };
-
-#if defined(dux_os_posix)
- auto _freepthrdhandl(void * handl) noexcept -> void;
- auto _getpthrdhandl() -> void *;
- auto _pthrdcrt( void * handl,auto (* fn)( void *) -> void *,void const * arg) -> void;
- auto _pthrdjoin( void * handl) -> void *;
-#endif
-}
-
-#include <dux/thrd.d/thrd.hh>
diff --git a/dux.svg b/logo/dux.svg
index 802e233..802e233 100644
--- a/dux.svg
+++ b/logo/dux.svg
diff --git a/dux_boxes.svg b/logo/dux_boxes.svg
index a55d0d2..a55d0d2 100644
--- a/dux_boxes.svg
+++ b/logo/dux_boxes.svg
diff --git a/u8c.svg b/logo/u8c.svg
index b20c621..b20c621 100644
--- a/u8c.svg
+++ b/logo/u8c.svg
diff --git a/u8c_boxes.svg b/logo/u8c_boxes.svg
index d6bad80..d6bad80 100644
--- a/u8c_boxes.svg
+++ b/logo/u8c_boxes.svg
diff --git a/u8c_braille.svg b/logo/u8c_braille.svg
index b885474..b885474 100644
--- a/u8c_braille.svg
+++ b/logo/u8c_braille.svg
diff --git a/src/dux/_setsiginthandl.cc b/src/dux/_setsiginthandl.cc
deleted file mode 100644
index ba6c9a4..0000000
--- a/src/dux/_setsiginthandl.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-
-#include "priv.hh"
-
-auto ::dux::_setsiginthandl() -> void {
- ::dux::dbgprint(U"dux :: Setting the SIGINT signal handler!\n");
- if (!::dux::_inst.siginthandlset) {
- ::dux::_inst.prevsiginthandl = ::dux::sighandl(::dux::sig::int_,::dux::_siginthandl);
- ::dux::_inst.siginthandlset = true;
- return;
- }
- ::dux::dbgprint(U"dux :: The SIGINT signal handler is already set!\n");
-};
diff --git a/src/dux/_siginthandl.cc b/src/dux/_siginthandl.cc
deleted file mode 100644
index 5a9bb13..0000000
--- a/src/dux/_siginthandl.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/sys>
-
-#include "priv.hh"
-
-auto ::dux::_siginthandl(::dux::sig) noexcept -> void {
- ::dux::_inst.hassigint = true; /* We have detected the SIGINT signal. The ::dux::win::pollevt function will check this value. */
-};
diff --git a/src/dux/_sigtocsig.cc b/src/dux/_sigtocsig.cc
deleted file mode 100644
index 3e2ca71..0000000
--- a/src/dux/_sigtocsig.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-#include <signal.h>
-
-#include "priv.hh"
-
-auto ::dux::_sigtocsig(::dux::sig const _sig) noexcept -> int {
- switch (_sig) {
- default:
- ::dux::print(U"dux :: _::dux::_sigtocsig recieved unknown signal!\n");
- ::dux::abrt();
- case ::dux::sig::abrt:
- return SIGABRT;
- case ::dux::sig::fpe:
- return SIGFPE;
- case ::dux::sig::ill:
- return SIGILL;
- case ::dux::sig::int_:
- return SIGINT;
- case ::dux::sig::segv:
- return SIGSEGV;
- case ::dux::sig::term:
- return SIGTERM;
-#if defined(dux_os_posix)
- case ::dux::sig::alrm:
- return SIGALRM;
- case ::dux::sig::bus:
- return SIGBUS;
- case ::dux::sig::cont:
- return SIGCONT;
- case ::dux::sig::hup:
- return SIGHUP;
- case ::dux::sig::iot:
- return SIGIOT;
- case ::dux::sig::kill:
- return SIGKILL;
- case ::dux::sig::pipe:
- return SIGPIPE;
- case ::dux::sig::poll:
- return SIGPOLL;
- case ::dux::sig::prof:
- return SIGPROF;
- case ::dux::sig::quit:
- return SIGQUIT;
- case ::dux::sig::rtmax:
- return SIGRTMAX;
- case ::dux::sig::rtmin:
- return SIGRTMIN;
- case ::dux::sig::stop:
- return SIGSTOP;
- case ::dux::sig::sys:
- return SIGSYS;
- case ::dux::sig::trap:
- return SIGTRAP;
- case ::dux::sig::tstp:
- return SIGTSTP;
- case ::dux::sig::ttin:
- return SIGTTIN;
- case ::dux::sig::ttou:
- return SIGTTOU;
- case ::dux::sig::urg:
- return SIGURG;
- case ::dux::sig::usr1:
- return SIGUSR1;
- case ::dux::sig::usr2:
- return SIGUSR2;
- case ::dux::sig::vtalrm:
- return SIGVTALRM;
- case ::dux::sig::winch:
- return SIGWINCH;
- case ::dux::sig::xcpu:
- return SIGXCPU;
- case ::dux::sig::xfsz:
- return SIGXFSZ;
-#endif
- }
-};
diff --git a/src/dux/abrt.cc b/src/dux/abrt.cc
deleted file mode 100644
index 391089f..0000000
--- a/src/dux/abrt.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-#if defined(dux_os_posix)
-#include <pthread.h>
-#endif
-
-namespace dux::_static {
-#if defined(dux_os_posix)
- static ::pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-}
-
-auto ::dux::abrt() noexcept -> void {
- ::pthread_mutex_lock(&::dux::_static::lock); /* Lock this so we will not abort from multiple threads. */
- ::dux::dbgprint(U"dux :: Aborting!\n");
- ::dux::dbgprint(U"dux :: Raising SIGABRT!\n");
- ::dux::raise(::dux::sig::abrt); /* We will now raise SIGABRT in an attempt to quit. */
- ::dux::dbgprint(U"dux :: Signal handler returned! Reset it!\n");
- ::dux::sighandl(::dux::sig::abrt,::dux::dflsighandl); /* The signal handler has returned, and so we will attempt to set the default handler. */
- ::dux::dbgprint(U"dux :: Raising SIGABRT!\n");
- ::dux::raise(::dux::sig::abrt); /* Raise SIGABRT again to call the default signal handler. */
- ::dux::dbgprint(U"dux :: Default signal handler returned! Trapping!\n");
- ::dux::trap(); /* The default signal handler returned, so we will trap or never return. */
-}
-auto ::dux::abrt(::dux::str const & _msg) noexcept -> void {
- ::dux::print(U"dux :: Aborting due to \"$\"!\n",_msg);
- ::dux::abrt();
-}
diff --git a/src/dux/endgfx.cc b/src/dux/endgfx.cc
deleted file mode 100644
index 90962ce..0000000
--- a/src/dux/endgfx.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-#include <dux/media>
-#if defined(dux_gfxproto_gl)
-#include <GL/gl.h>
-#endif
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#include <wayland-client.h>
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
-#include <xcb/xcb.h>
-#if defined(dux_gfxproto_gl)
-#include <GL/glx.h>
-#include <X11/Xlib-xcb.h>
-#endif
-#endif
-
-#include "priv.hh"
-
-auto ::dux::endgfx() -> void {
- ::dux::dbgprint(U"dux :: Ending the graphics module...\n");
- dux_ass(!::dux::_inst.numwin,"Ammount of windows is non-zero!");
- if (!::dux::_inst.gfxinit) [[unlikely]] {
- goto isend;
- }
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::dux::print(U"dux :: Disconnecting from the X server!\n");
- ::xcb_disconnect(::dux::_inst.xconn);
-#endif
-isend:;
- ::dux::dbgprint(U"dux :: Ending successful!\n");
-}
diff --git a/src/dux/goatmaster.cc b/src/dux/goatmaster.cc
deleted file mode 100644
index 8eb350b..0000000
--- a/src/dux/goatmaster.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-
-[[dux_attr_cold]] extern "C" void goatmaster(int const _x) { /* Test function for dynamic linking. */
- ::dux::print(U"The Goat Master has been summoned with the number $!\n",_x);
-}
diff --git a/src/dux/initgfx.cc b/src/dux/initgfx.cc
deleted file mode 100644
index 3ab4141..0000000
--- a/src/dux/initgfx.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-#include <dux/media>
-#if defined(dux_gfxproto_gl)
-#include <GL/gl.h>
-#endif
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#include <wayland-client.h>
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
-#include <xcb/xcb.h>
-#if defined(dux_gfxproto_gl)
-#include <GL/glx.h>
-#include <X11/Xlib-xcb.h>
-#endif
-#endif
-
-#include "priv.hh"
-
-auto ::dux::initgfx() -> void {
- ::dux::dbgprint(U"dux :: Initialising the graphics module...\n");
- if (::dux::_inst.gfxinit) [[unlikely]] {
- goto isinit;
- }
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
- try {
- auto const * const dux_restr envval = ::dux::getenv("XDG_SESSION_TYPE");
- if (!!::dux::cstrcmp(envval,"wayland")) [[unlikely]] {
- ::dux::print(U"dux :: Environment variable \"XDG_SESSION_TYPE\" is not set to \"wayland\", but dux is targeting Wayland!\n");
- }
- }
- catch (::dux::except const & e) {
- }
- ::dux::dbgprint(U"dux :: Wayland support is experimental!\n");
- ::dux::_inst.wldisp = ::wl_display_connect(nullptr);
- if (::dux::_inst.wldisp == nullptr) [[unlikely]] {
- throw ::dux::runerr("Unable to open Wayland display!");
- }
-#else
- if (::dux::_inst.xconn = ::xcb_connect(nullptr,nullptr);::dux::_inst.xconn == nullptr) [[unlikely]] {
- throw ::dux::runerr("Unable to open connection to X server.");
- }
- ::dux::dbgprint(U"dux :: Made a connection to an X server!\n");
- ::dux::_inst.xscrn = ::xcb_setup_roots_iterator(xcb_get_setup(::dux::_inst.xconn)).data;
- ::dux::dbgprint(U"dux :: Set up roots iterator!\n");
-#endif
- ::dux::_inst.gfxinit = true;
-isinit:;
- ::dux::dbgprint(U"dux :: Initialisation successful!\n");
-}
diff --git a/src/dux/priv.hh b/src/dux/priv.hh
deleted file mode 100644
index 1c497d5..0000000
--- a/src/dux/priv.hh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#if !defined(dux_hdr_priv)
-#define dux_hdr_priv
-
-#include <dux/sys>
-#if defined(dux_os_posix)
-#include <pthread.h>
-#endif
-#if defined(dux_winsproto_wl)
-#include <wayland-client.h>
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
-#include <xcb/xcb.h>
-#endif
-
-namespace dux {
- class _insttyp {
- public:
- bool gfxinit {false};
- bool hassigint {false};
- ::dux::uint16 numwin {::dux::uint16v(0x0)};
- void (* prevsiginthandl)(::dux::sig){::dux::dflsighandl}; /* Used for setting the previous signal handler in case there aren't any open windows to handle the signal. */
- bool siginthandlset {false};
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
- ::wl_display * wldisp{nullptr};
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::xcb_connection_t * xconn{nullptr};
- ::xcb_screen_t * xscrn{nullptr};
-#endif
- } inline _inst;
-
-#if defined(dux_os_posix)
- class _pthrddat {
- public:
- pthread_t pthrd;
- };
-#endif
-
- auto _setsiginthandl() -> void;
- auto _siginthandl( ::dux::sig) noexcept -> void;
- auto _sigtocsig( ::dux::sig sig) noexcept -> int;
-}
-
-#endif
diff --git a/src/dux/qexit.cc b/src/dux/qexit.cc
deleted file mode 100644
index 8cebfb8..0000000
--- a/src/dux/qexit.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/sys>
-
-#if defined(dux_os_linux)
-#include <sys/syscall.h>
-#include <unistd.h>
-#elif defined(dux_os_posix)
-#include <stdlib.h>
-#else
-#include <cstdlib>
-#endif
-
-auto ::dux::qexit(::dux::stat const _stat) noexcept -> void {
-#if defined(dux_os_linux)
- auto const stat = _stat == ::dux::stat::ok ? 0x0 : 0x1;
- ::syscall(__NR_exit_group,stat);
- ::syscall(__NR_exit,stat);
- ::dux::trap();
-#else
- auto const stat = _stat == ::dux::stat::ok ? EXIT_SUCCESS : EXIT_FAILURE;
-#if defined(dux_os_posix)
- ::_exit(stat);
- ::dux::trap();
-#else
- ::std::_Exit(stat);
-#endif
-#endif
-}
diff --git a/src/dux/raise.cc b/src/dux/raise.cc
deleted file mode 100644
index 3c0d020..0000000
--- a/src/dux/raise.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-
-#include <signal.h>
-#if defined(dux_os_linux)
-#include <sys/syscall.h>
-#include <unistd.h>
-#else
-#include <pthread.h>
-#endif
-
-#include "priv.hh"
-
-auto ::dux::raise(::dux::sig const _sig) noexcept -> void {
- ::dux::dbgprint(U"dux :: Raising signal #$!\n",static_cast<int>(_sig));
-#if !defined(dux_os_posix)
- if (_sig == ::dux::sig::kill) {
- ::dux::abrt();
- }
- if (_sig == ::dux::sig::trap) {
- ::dux::trap();
- }
-#endif
- auto const sig = ::dux::_sigtocsig(_sig);
-#if defined(dux_os_linux)
- ::dux::dbgprint(U"dux :: Killing process via syscall!\n");
- ::syscall(__NR_kill,::syscall(__NR_getpid),sig);
-#elif defined(dux_os_posix)
-::dux::dbgprint(U"dux :: Killing thread!\n");
- ::pthread_kill(::pthread_self(),sig);
-#else
- ::dux::dbgprint(U"dux :: Raising signal!\n");
- ::raise(sig);
-#endif
-}
diff --git a/src/dux/sighandl.cc b/src/dux/sighandl.cc
deleted file mode 100644
index 8e21505..0000000
--- a/src/dux/sighandl.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/io>
-
-#include <cerrno>
-#include <signal.h>
-#if defined(dux_os_linux)
-#include <sys/syscall.h>
-#include <unistd.h>
-#endif
-
-#include "priv.hh"
-
-namespace dux::_static {
- static auto (* _sighandls[::dux::numsig])(::dux::sig) -> void;
-
- static auto _sigwrap(int sig) -> void;
-}
-
-static auto ::dux::_static::_sigwrap(int const _sig) -> void {
-#if !defined(dux_os_posix)
- ::signal(_sig,::dux::_static::sigwrap);
-#endif
- auto const sig = [&]() {
- switch(_sig) {
- default:
- ::dux::abrt();
- case SIGABRT:
- return ::dux::sig::abrt;
- case SIGFPE:
- return ::dux::sig::fpe;
- case SIGILL:
- return ::dux::sig::ill;
- case SIGINT:
- return ::dux::sig::int_;
- case SIGSEGV:
- return ::dux::sig::segv;
- case SIGTERM:
- return ::dux::sig::term;
- }
- }();
- ::dux::_static::_sighandls[static_cast<::dux::usz>(sig)](sig);
-}
-
-auto ::dux::sighandl(::dux::sig const _sig,auto (* const _handl)(::dux::sig) -> void) -> auto (&)(::dux::sig) -> void {
- ::dux::print(U"dux :: Setting signal handler!\n");
- auto & handl = ::dux::_static::_sighandls[static_cast<::dux::usz>(_sig)];
- auto const oldhandl = handl;
- handl = _handl;
- auto const sig = ::dux::_sigtocsig(_sig);
- if (_handl == ::dux::dflsighandl) {
- ::signal(sig,SIG_DFL);
- goto ret;
- }
- {
-#if defined(dux_os_posix)
- struct ::sigaction sigact{};
- sigact.sa_handler = ::dux::_static::_sigwrap;
- ::sigemptyset(&sigact.sa_mask);
- sigact.sa_flags = SA_RESTART;
-#endif
- if ([&]() {
-//#if defined(dux_os_linux)
-// return ::syscall(__NR_rt_sigaction,sig,&sigact,nullptr,sizeof(::sigset_t)) == -0x1l; /* This syscall returns EINVAL and I could not get it to work. */
-//#elif defined(dux_os_posix)
-#if defined(dux_os_posix)
- return ::sigaction(sig,&sigact,nullptr) == -0x1;
-#else
- return ::std::signal(sig,::dux::_static::_sigwrap) == SIG_ERR;
-#endif
- }()) [[unlikely]] {
- throw ::dux::runerr("Unable to set signal handler!");
- }
- }
-ret:;
- return *oldhandl;
-}
diff --git a/src/dux/sleep.cc b/src/dux/sleep.cc
deleted file mode 100644
index 84a74da..0000000
--- a/src/dux/sleep.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/sys>
-#if defined(dux_os_posix)
-#include <unistd.h>
-#if defined(dux_os_linux)
-#include <sys/syscall.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-auto ::dux::sleep(::dux::uint64 const _sec,::dux::uint64 const _nsecx,::dux::uint64 const _nsecy) noexcept -> void {
-#if defined(dux_os_posix)
-#if defined(dux_os_linux)
- class {
- public:
- ::dux::uint64 tv_sec;
- long tv_nsec;
- } timespec;
-#else
- ::timespec timespec;
-#endif
- timespec.tv_sec = _sec;
- timespec.tv_nsec = static_cast<long>(static_cast<float>(_nsecx) / static_cast<float>(_nsecy) * 0x3B9ACA00p0);
-#if defined(dux_os_linux)
- ::syscall(__NR_nanosleep,&timespec,&timespec);
-#else
- ::nanosleep(&timespec,&timespec);
-#endif
-#endif
-}
diff --git a/src/dux/trap.cc b/src/dux/trap.cc
deleted file mode 100644
index a689451..0000000
--- a/src/dux/trap.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/sys>
-
-auto ::dux::trap() noexcept -> void {
- for (;;) {
-#if defined(dux_os_unix)
- ::dux::raise(::dux::sig::trap);
-#elif dux_hasbuiltin(__builtin_trap)
- ::__builtin_trap();
-#elif dux_hasbuiltin(__debugbreak)
- ::__debugbreak();
-#else
- ::dux::qexit(::dux::stat::err);
-#endif
- }
-};
diff --git a/src/dux/unreach.cc b/src/dux/unreach.cc
deleted file mode 100644
index f03de41..0000000
--- a/src/dux/unreach.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <dux/sys>
-
-auto ::dux::unreach() noexcept -> void {
-#if dux_hasbuiltin(__assume)
- ::__assume(false);
-#elif dux_hasbuiltin(__builtin_unreachable)
- ::__builtin_unreachable();
-#else
- ::dux::trap();
-#endif
-}
diff --git a/src/dux/win.cc b/src/dux/win.cc
deleted file mode 100644
index 2957892..0000000
--- a/src/dux/win.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Copyright 2021 Gabriel Jensen
-
- This file is part of dux.
-
- dux 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.
-
- dux 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 dux.
- If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include <cstdlib>
-#include <dux/io>
-#include <dux/media>
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#include <wayland-client.h>
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
-#include <xcb/xcb.h>
-#include <xcb/xcb_atom.h>
-#endif
-
-#include "priv.hh"
-
-namespace dux {
- class windat {
- public:
- bool open{false};
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
- ::wl_shell_surface * wlsurf{nullptr};
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::xcb_window_t xwin{};
-#endif
- };
-}
-auto ::dux::win::close() -> void {
- [[maybe_unused]] auto * const dux_restr dat = static_cast<::dux::windat *>(this->_dat);
- ::dux::dbgprint(U"dux :: Closing window!\n");
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::xcb_unmap_window(::dux::_inst.xconn,dat->xwin);
- ::xcb_flush(::dux::_inst.xconn);
-# endif
- this->_isopen = false;
- ::dux::_inst.numwin -= ::dux::uint16v(0x1);
- ::dux::dbgprint(U"dux :: Current number of windows: $\n",::dux::_inst.numwin);
- ::dux::dbgprint(U"dux :: Unsetting the SIGINT signal handler!\n");
- if (!::dux::_inst.numwin) {
- ::dux::sighandl(::dux::sig::int_,*::dux::_inst.prevsiginthandl);
- ::dux::_inst.siginthandlset = false;
- return;
- }
- ::dux::dbgprint(U"dux :: An open window exists!\n");
-}
-auto ::dux::win::crt(char const * const dux_restr _nm,::dux::uint16 const _w,::dux::uint16 const _h) -> ::dux::win {
- ::dux::win win;
- [[maybe_unused]] auto * const dux_restr dat = static_cast<::dux::windat *>(win._dat);
-#if defined(dux_gfxproto_wlgl)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- dat->xwin = ::xcb_generate_id(::dux::_inst.xconn);
- ::dux::uint32 valmask[] = {
- XCB_EVENT_MASK_EXPOSURE,
- };
- ::xcb_create_window(::dux::_inst.xconn,XCB_COPY_FROM_PARENT,dat->xwin,::dux::_inst.xscrn->root,::dux::uint16v(0x0),::dux::uint16v(0x0),_w,_h,::dux::uint16v(0x0),XCB_WINDOW_CLASS_INPUT_OUTPUT,::dux::_inst.xscrn->root_visual,::dux::uint32v(0x0),valmask);
- ::xcb_map_window(::dux::_inst.xconn,dat->xwin);
- ::xcb_flush(::dux::_inst.xconn);
- win.renm(_nm);
-#endif
- ::dux::_inst.numwin += ::dux::uint16v(0x1);
- ::dux::dbgprint(U"dux :: Current number of windows: $\n",::dux::_inst.numwin);
- ::dux::_setsiginthandl();
- win._isopen = true;
- return win;
-}
-auto ::dux::win::destr() noexcept -> void {
- ::dux::dbgprint(U"dux :: Destroying window!\n");
- this->close();
- ::delete static_cast<::dux::windat *>(this->_dat);
-}
-auto ::dux::win::open() -> void {
- [[maybe_unused]] auto * const dux_restr dat = static_cast<::dux::windat *>(this->_dat);
- ::dux::dbgprint(U"dux :: Opening window!\n");
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::xcb_map_window(::dux::_inst.xconn,dat->xwin);
- ::xcb_flush(::dux::_inst.xconn);
-# endif
- ::dux::_inst.numwin += ::dux::uint16v(0x1);
- ::dux::dbgprint(U"dux :: Current number of windows: $\n",::dux::_inst.numwin);
- ::dux::_setsiginthandl();
- this->_isopen = true;
-}
-auto ::dux::win::pollevt() noexcept -> ::dux::opt<::dux::evt> {
- ::dux::evt evt;
- if (::dux::_inst.hassigint) [[unlikely]] {
- evt.typ = ::dux::evttyp::quit;
- ::dux::_inst.hassigint = false;
- return evt;
- }
-#if defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- while (auto const xevt = ::xcb_poll_for_event(::dux::_inst.xconn)) {
- switch (xevt->response_type & ~0x80) {
- case XCB_CLIENT_MESSAGE:
- evt.typ = ::dux::evttyp::quit;
- break;
- }
- ::std::free(xevt);
- return evt;
- }
-#endif
- return evt;
-}
-auto ::dux::win::renm(char const * const dux_restr _nm) -> void {
- [[maybe_unused]] auto * const dux_restr dat = static_cast<::dux::windat *>(this->_dat);
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::xcb_change_property(::dux::_inst.xconn,XCB_PROP_MODE_REPLACE,dat->xwin,XCB_ATOM_WM_NAME,XCB_ATOM_STRING,::dux::ubytev(0x8),static_cast<::dux::uint32>(::dux::cstrlen(_nm)),_nm);
- ::xcb_flush(::dux::_inst.xconn);
-# endif
-}
-auto ::dux::win::resz(::dux::uint16 const _w,::dux::uint16 const _h) -> void {
- [[maybe_unused]] auto * const dux_restr dat = static_cast<::dux::windat *>(this->_dat);
-#if defined(dux_gfxproto_wlgl) || defined(dux_gfxproto_wlvk)
-#elif defined(dux_gfxproto_xgl) || defined(dux_gfxproto_xvk)
- ::dux::uint32 const vals[] = {
- _w,
- _h,
- };
- ::xcb_configure_window(::dux::_inst.xconn,dat->xwin,XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_WIDTH,vals);
- ::xcb_flush(::dux::_inst.xconn);
-#endif
-}
-::dux::win::win() : _dat(::new ::dux::windat) {
-}
-::dux::win::~win() noexcept {
- if (this->_isopen) [[unlikely]] {
- ::dux::dbgprint(U"dux :: Window was not closed!\n");
- ::dux::abrt();
- }
-}