diff options
135 files changed, 333 insertions, 11600 deletions
@@ -1,3 +1,5 @@ -/build -/dux-io-demo -vgcore.*
\ No newline at end of file +*.a +*.o +*.so +/demo +/tmp diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a832cc7..34421df 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,51 @@ +| 0.0.0 + +- Revive and rewrite project (current features will be listed); +- Merge with Flux and Burst; +- Use zp versioning: api.ext.pat; +- Use GNU Make; +- Depend on zp; +- Use Git tagging for versioning; +- Add input/output header: io; +- Add function for creating files: crtfil; +- License under LGPL3 or later; +- Add enumerations for errors; +- Add function for aborting: abr; +- Add function for getting error mesasges: errmsg; +- Update gitignore; +- Add structure for files; +- Add integral type for file permissions; +- Add multithreading header: thr; +- Add function for creating threads: crtthr; +- Add private header; +- Add base header: dux; +- Add API and extension version constants: api, ext; +- Add structure for threads: thr; +- Add function for joining threads: joithr; +- Add global file for default input: dfli; +- Add global file for default output: dflo; +- Add global file for default logging: log; +- Add function for exiting the current thread: exi; +- Add function for sleeping: slp; +- Add demo; +- Add structure for storing path information: pthinf; +- Add function for getting the current directory: curdir; +- Add function for getting the home directory: homdir; +- Add function for changing the current directory: chgdir; +- Add function for statting paths: sttpth; +- Add function for setting the permissions of a path: setprm; +- Add function for creating directories: crtdir; +- Add function for copying files: cpy; +- Add function for moving files/directories: mov; +- Add function for removing files: rem; +- Add function for writing to files: wrt; +- Add function for reading from files: red; +- Add function for writing strings to files: wrtstr; +- Rewrite readme and in plain text; +- Add function for starting threads: srtthr; +- Adjust copyright years for oldest versions; +- Note: Currently, only errmsg is implemented; + | 2↋ - Fix signal pipe being renamed to file; diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 7730619..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -cmake_minimum_required( - VERSION - 3.19 -) - -# Project: -project( - dux -) - -# Constants: -set( - DUX_VERSION - 35 -) - -# Subdirectories -add_subdirectory( - "dux" -) -if( - DUX_ENABLE_DEMO -) - add_subdirectory( - "dux-demo" - ) -endif() diff --git a/COPYING b/COPYING deleted file mode 100644 index be3f7b2..0000000 --- a/COPYING +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -<https://www.gnu.org/licenses/>. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..eb1aa02 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: dux test + +dux: + $(MAKE) -C dux + +test: dux + $(MAKE) -C dux-test
\ No newline at end of file diff --git a/README.html b/README.html deleted file mode 100644 index cc3a7cb..0000000 --- a/README.html +++ /dev/null @@ -1,33 +0,0 @@ -<!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/about">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 & 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="http://www.gnu.org/licenses">https://www.gnu.org/licenses</a>.</p> -</html> diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..63552a1 --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +dux @@ -0,0 +1,7 @@ +#include <dux/io.h> +#include <dux/thr.h> +#include <iostream> + +int main() { + ::std::cout << "dux " << dux_api << '.' << dux_ext << ", demo" << ::std::endl; +} diff --git a/dux-demo/CMakeLists.txt b/dux-demo/CMakeLists.txt deleted file mode 100644 index 7c799d8..0000000 --- a/dux-demo/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index 7b67510..0000000 --- a/dux-demo/ctest.c +++ /dev/null @@ -1,46 +0,0 @@ -# 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 deleted file mode 100644 index 5c22ec2..0000000 --- a/dux-demo/main.cc +++ /dev/null @@ -1,229 +0,0 @@ -# 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("dux.demo :: 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("dux.demo :: 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("dux.demo :: 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"); - goto test; - } - num0 = ::dux::rnd<::dux::uint8>(); - num1 = ::dux::rnd<::dux::uint8>(); - } - } -test:; - auto const time = ::dux::gettime(); - ::dux::dbglog("dux.demo :: 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("Error setter didn't work!",::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(); - } - 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); - } - { - dux_ass("",::dux::memeq("ABC",dux_uwrdl(0x3),"ABC")); - auto file {::dux::crtfile("dux-io-demo")}; - file.write("Hello there!"); - file.open("dux-io-demo",::dux::iotyp::r); - auto const dat {file.read(dux_uwrdl(0xC))}; - dux_ass("",dat.sz() == dux_uwrdl(0xC)); - dux_ass("",::dux::memeq(dat.craw(),dat.sz(),"Hello there!")); - file.close(); - } - if (::dux::haserr()) [[unlikely]] { - ::dux::dbglog("dux.\x1B[91mdemo\x1B[0m :: Got error %S!\n",::dux::errcdnm(::dux::geterr())); - ::dux::exit(::dux::stat::err); - } - ::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 deleted file mode 100644 index e4ceb10..0000000 --- a/dux/CMakeLists.txt +++ /dev/null @@ -1,144 +0,0 @@ -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 - DESCRIPTION - "General purpose library." - HOMEPAGE_URL - "https://mandelbrot.dk/dux/about/" - 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/fsync.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/read.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/crtfile.cc" - "src/errcdnm.cc" - "src/exit.cc" - "src/file.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/ismainthrd.cc" - "src/mainparams.cc" - "src/memeq.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/GNUmakefile b/dux/GNUmakefile new file mode 100644 index 0000000..6ed22e4 --- /dev/null +++ b/dux/GNUmakefile @@ -0,0 +1,56 @@ +ifneq "$(dbg)" "true" +dbg := false +endif + +OBJS := \ + source/dux/errmsg.o + +HDRS := \ + include/dux/dux.h \ + include/dux/io.h \ + include/dux/thr.h \ + include-private/dux/prv/dux.h + +CFLAGS := \ + -D_GNU_SOURCE \ + -Ddux_prv_dbg=$(dbg) \ + -Iinclude \ + -Iinclude-private \ + -Ofast \ + -Wall \ + -Wextra \ + -Wmissing-prototypes \ + -Wpedantic \ + -fpic \ + -fshort-enums \ + -g \ + -pipe \ + -std=c99 + +LDFLAGS := \ + -shared + +LDLIBS := \ + -lzp + +LIB = libdux.so + +.PHONY: clean install purge + +$(LIB): $(OBJS) + $(CC) $(LDFLAGS) -o$(@) $(OBJS) $(LDLIBS) + +$(OBJS): $(HDRS) + +install: $(LIB) + mkdir -pvm755 "$(HDRDIR)/dux/imp" + mkdir -pvm755 "$(LIBDIR)" + install -vm644 "include/dux/"{"bs","fs","io"}{"",".h"} "$(HDRDIR)/dux" + install -vm644 "include/dux/imp/"{"bs","fs","io"}".ii" "$(HDRDIR)/dux/imp" + install -vm755 "$(LIB)" "$(LIBDIR)" + +clean: + $(RM) $(OBJS) + +purge: clean + $(RM) $(LIB) diff --git a/dux/include-priv/dux/c/priv.h b/dux/include-priv/dux/c/priv.h deleted file mode 100644 index 86f5c17..0000000 --- a/dux/include-priv/dux/c/priv.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - 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-priv/dux/cxx/priv.hh b/dux/include-priv/dux/cxx/priv.hh deleted file mode 100644 index 3e48839..0000000 --- a/dux/include-priv/dux/cxx/priv.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* - 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 <atomic> -# include <csetjmp> - -namespace dux::priv { - class filesysdat { - public: -# if defined(dux_os_posix) - int fd; -# endif - }; -} - -namespace dux::priv { - inline ::std::jmp_buf exitjmp; - inline ::dux::stat volatile exitstat; - - 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 deleted file mode 100644 index cef96fa..0000000 --- a/dux/include-priv/dux/priv +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index 02f1364..0000000 --- a/dux/include-priv/dux/priv.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - 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 <fcntl.h> -# 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_openat( int fd, char const * pathname,int flags, mode_t mode); -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/dux/include-private/dux/prv/dux.h b/dux/include-private/dux/prv/dux.h new file mode 100644 index 0000000..f6bcfc5 --- /dev/null +++ b/dux/include-private/dux/prv/dux.h @@ -0,0 +1,19 @@ +/* + Copyright 2019-2023 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 Lesser 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>. +*/ + +#if !defined(dux_hdr_prv_dux) +#define dux_hdr_prv_dux + +#include <dux/dux.h> + +dux_prv_cdec + +dux_prv_cdecend + +#endif diff --git a/dux/include/dux/arr b/dux/include/dux/arr deleted file mode 100644 index 5ebe2de..0000000 --- a/dux/include/dux/arr +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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/arr.h> - -# if defined(dux_lang_c) -# include <dux/c/arr.h> -# elif defined(dux_lang_cxx) -# include <dux/cxx/arr.hh> -# endif diff --git a/dux/include/dux/arr.h b/dux/include/dux/arr.h deleted file mode 100644 index 86f5c17..0000000 --- a/dux/include/dux/arr.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - 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/base b/dux/include/dux/base deleted file mode 100644 index 3fd745d..0000000 --- a/dux/include/dux/base +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index 97cdef4..0000000 --- a/dux/include/dux/base.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - 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) -# define restrict __restrict__ -# elif defined(dux_cmpl_msvc) -# define restrict __restrict -# else -# define restrict -# endif -# endif - -# define dux_priv_ver 0x23 - -# 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_priv_nullptr ((void *)0x0) -# define dux_nullptr dux_priv_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_badperms, /* Bad permissions: Operation was not permitted */ - dux_priv_errcd_badfile, /* Bad file: 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_ioerr, /* Bad input/output: Unable to read or write to file */ - 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_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); -int dux_priv_posix_fsync( int fd); -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); -dux_priv_swrd dux_priv_posix_read( int fd, void * buf, dux_priv_uwrd count); - -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/arr.h b/dux/include/dux/c/arr.h deleted file mode 100644 index 86f5c17..0000000 --- a/dux/include/dux/c/arr.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - 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/c/base.h b/dux/include/dux/c/base.h deleted file mode 100644 index 3fa6e4f..0000000 --- a/dux/include/dux/c/base.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - 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_badperms = dux_priv_errcd_badperms, - dux_errcd_badfile = dux_priv_errcd_badfile, - 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_ioerr = dux_priv_errcd_ioerr, - dux_errcd_matherr = dux_priv_errcd_matherr, - dux_errcd_nodir = dux_priv_errcd_nodir, - dux_errcd_nofile = dux_priv_errcd_nofile, - 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/dux/include/dux/c/io.h b/dux/include/dux/c/io.h deleted file mode 100644 index 321f413..0000000 --- a/dux/include/dux/c/io.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - 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_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 deleted file mode 100644 index 784e7ba..0000000 --- a/dux/include/dux/c/math.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - 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/dux/include/dux/c/media.h b/dux/include/dux/c/media.h deleted file mode 100644 index cc5862e..0000000 --- a/dux/include/dux/c/media.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - 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_nomedia dux_priv_nomedia diff --git a/dux/include/dux/c/mem.h b/dux/include/dux/c/mem.h deleted file mode 100644 index 012df35..0000000 --- a/dux/include/dux/c/mem.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - 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/dux/include/dux/c/seq.h b/dux/include/dux/c/seq.h deleted file mode 100644 index 39256c3..0000000 --- a/dux/include/dux/c/seq.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - 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_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 deleted file mode 100644 index 63e8b1a..0000000 --- a/dux/include/dux/c/sig.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - 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 deleted file mode 100644 index 368d0c7..0000000 --- a/dux/include/dux/c/str.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - 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 deleted file mode 100644 index 415c829..0000000 --- a/dux/include/dux/c/thrd.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - 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 bool dux_ismainthrd(void); diff --git a/dux/include/dux/c/time.h b/dux/include/dux/c/time.h deleted file mode 100644 index 6dcfa4c..0000000 --- a/dux/include/dux/c/time.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - 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 dux_sint64 dux_gettime(void); - void dux_sleep( dux_uint64 sec); diff --git a/dux/include/dux/cxx/arr.hh b/dux/include/dux/cxx/arr.hh deleted file mode 100644 index 4b0d81e..0000000 --- a/dux/include/dux/cxx/arr.hh +++ /dev/null @@ -1,96 +0,0 @@ -/* - 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> 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.raw(),_oth.sz(),this->raw()); - } - 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 craw() const noexcept -> T const * {return this->_dat;} - constexpr auto raw() noexcept -> T * {return this->_dat;} - constexpr auto raw() const noexcept -> T const * {return this->_dat;} - constexpr auto sz() const noexcept -> ::dux::uwrd {return this->_sz;} - - constexpr auto begin() noexcept -> T * {return this->raw();} - constexpr auto begin() const noexcept -> T const * {return this->raw();} - constexpr auto end() noexcept -> T * {return this->raw() + this->sz();} - constexpr auto end() const noexcept -> T const * {return this->raw() + 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; - }; -} diff --git a/dux/include/dux/cxx/base.hh b/dux/include/dux/cxx/base.hh deleted file mode 100644 index 1f37dd9..0000000 --- a/dux/include/dux/cxx/base.hh +++ /dev/null @@ -1,399 +0,0 @@ -/* - 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 static 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, - badperms = ::dux_priv_errcd_badperms, - badfile = ::dux_priv_errcd_badfile, - 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, - ioerr = ::dux_priv_errcd_ioerr, - matherr = ::dux_priv_errcd_matherr, - nodir = ::dux_priv_errcd_nodir, - nofile = ::dux_priv_errcd_nofile, - 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::ioerr: - return ::dux::priv::strlittoduxstr("BADIO"); - case ::dux::errcd::badperms: - return ::dux::priv::strlittoduxstr("BADPERMS"); - case ::dux::errcd::badfile: - 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::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/dux/include/dux/cxx/io.hh b/dux/include/dux/cxx/io.hh deleted file mode 100644 index 19ecaf7..0000000 --- a/dux/include/dux/cxx/io.hh +++ /dev/null @@ -1,82 +0,0 @@ -/* - 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::ioacs { - constexpr static auto uid {static_cast<::dux::uint16>(dux_priv_ioacs_uid)}; - constexpr static auto gid {static_cast<::dux::uint16>(dux_priv_ioacs_gid)}; - constexpr static auto stck {static_cast<::dux::uint16>(dux_priv_ioacs_stck)}; - constexpr static auto usrr {static_cast<::dux::uint16>(dux_priv_ioacs_usrr)}; - constexpr static auto usrw {static_cast<::dux::uint16>(dux_priv_ioacs_usrw)}; - constexpr static auto usrx {static_cast<::dux::uint16>(dux_priv_ioacs_usrx)}; - constexpr static auto grpr {static_cast<::dux::uint16>(dux_priv_ioacs_grpr)}; - constexpr static auto grpw {static_cast<::dux::uint16>(dux_priv_ioacs_grpr)}; - constexpr static auto grpx {static_cast<::dux::uint16>(dux_priv_ioacs_grpr)}; - constexpr static auto othr {static_cast<::dux::uint16>(dux_priv_ioacs_othr)}; - constexpr static auto othw {static_cast<::dux::uint16>(dux_priv_ioacs_othr)}; - constexpr static auto othx {static_cast<::dux::uint16>(dux_priv_ioacs_othr)}; -} - -namespace dux { - enum class 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), - }; -} - -namespace dux { - class file; -} - -namespace dux { - [[nodiscard]] auto crtfile(char const * path,::dux::uint16 acs = ::dux::ioacs::usrr | ::dux::ioacs::usrw | ::dux::ioacs::grpr | ::dux::ioacs::othr /* -rw-r--r-- */) noexcept -> ::dux::file; -} - -namespace dux { - class file { - public: - [[nodiscard]] file() noexcept; - ~file() noexcept; - - auto close() noexcept -> void; - auto del() noexcept -> void = delete; - [[nodiscard]] auto isopen() noexcept -> bool; - auto open( char const * path, ::dux::iotyp typ) noexcept -> void; - [[nodiscard]] auto path() const noexcept -> ::dux::str; - [[nodiscard]] auto read( ::dux::uwrd num = dux_uwrdl(-0x1)) noexcept -> ::dux::arr<::dux::uint8>; - auto mv( char const * newpath) noexcept -> ::dux::str = delete; - auto reopen() noexcept -> void; - [[nodiscard]] auto typ() const noexcept -> ::dux::iotyp; - auto write( void const * buf, ::dux::uwrd sz) noexcept -> void; - - template<::dux::uwrd N> auto write(char const (& _buf)[N]) noexcept -> void {this->write(_buf,N - dux_uwrdl(0x1));} - template<typename T> auto write(T const & _val) noexcept -> void {this->write(&_val,sizeof (T));} - template<typename T> auto write(::dux::arr<T> const & _buf) noexcept -> void { - dux_ass("",_buf.isalloc()); - this->write(_buf.raw(),_buf.sz() * sizeof (T)); - } - - friend auto ::dux::crtfile(char const * path,::dux::uint16 acs) noexcept -> ::dux::file; - private: - bool _isopen; - ::dux::str _path; - void * _sysdat; - ::dux::iotyp _typ; - }; -} diff --git a/dux/include/dux/cxx/math.hh b/dux/include/dux/cxx/math.hh deleted file mode 100644 index a0b885b..0000000 --- a/dux/include/dux/cxx/math.hh +++ /dev/null @@ -1,141 +0,0 @@ -/* - 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 deleted file mode 100644 index a80db67..0000000 --- a/dux/include/dux/cxx/media.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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 deleted file mode 100644 index 28b299c..0000000 --- a/dux/include/dux/cxx/mem.hh +++ /dev/null @@ -1,92 +0,0 @@ -/* - 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 deleted file mode 100644 index afff578..0000000 --- a/dux/include/dux/cxx/seq.hh +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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]] auto memeq(void const * lptr,::dux::uwrd const num,void const * rptr) noexcept -> bool; - - 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 deleted file mode 100644 index b295730..0000000 --- a/dux/include/dux/cxx/sig.hh +++ /dev/null @@ -1,96 +0,0 @@ -/* - 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 deleted file mode 100644 index 155f661..0000000 --- a/dux/include/dux/cxx/str.hh +++ /dev/null @@ -1,92 +0,0 @@ -/* - 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 deleted file mode 100644 index 4e3da67..0000000 --- a/dux/include/dux/cxx/thrd.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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]] auto ismainthrd() noexcept -> bool; -} diff --git a/dux/include/dux/cxx/time.hh b/dux/include/dux/cxx/time.hh deleted file mode 100644 index d24e1f8..0000000 --- a/dux/include/dux/cxx/time.hh +++ /dev/null @@ -1,23 +0,0 @@ -/* - 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]] auto gettime() noexcept -> ::dux::sint64; - auto sleep( ::dux::uint64 sec) noexcept -> void; -} diff --git a/dux/include/dux/dux.h b/dux/include/dux/dux.h new file mode 100644 index 0000000..e764f81 --- /dev/null +++ b/dux/include/dux/dux.h @@ -0,0 +1,52 @@ +/* + Copyright 2019-2023 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 Lesser 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>. +*/ + +#if !defined(dux_hdr_dux) +#define dux_hdr_dux + +#include <zp/zp.h> // We always guarantee this header. + +#if zp_std_cxx +#define dux_prv_cdec extern "C" { +#define dux_prv_cdecend } +#else +#define dux_prv_cdec +#define dux_prv_cdecend +#endif + +dux_prv_cdec + +#define dux_api ((zp_i04)+0x0u) +#define dux_ext ((zp_i04)+0x0u) + +typedef enum { + dux_err_oky = 0x0u, + dux_err_err = 0x1u, + dux_err_badalc, + dux_err_badfil, + dux_err_badfmt, + dux_err_badprm, + dux_err_badval, + dux_err_eof, + dux_err_exs, + dux_err_isdir, + dux_err_nodir, + dux_err_nofil, + dux_err_redonl, + dux_err_spclim, +} dux_err; + +zp_noret void dux_prv_abr(char const * fil,long lin,char const * fun,char const * msg,...); +#define dux_abr(msg) (dux_prv_abr(__FILE__,__LINE__,__func__,(msg))) + +zp_unseq char const * dux_errmsg(dux_err err); + +dux_prv_cdecend + +#endif diff --git a/dux/include/dux/io b/dux/include/dux/io deleted file mode 100644 index c0a05d5..0000000 --- a/dux/include/dux/io +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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/arr> - -# include <dux/io.h> - -# 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 index 60c31df..5417f60 100644 --- a/dux/include/dux/io.h +++ b/dux/include/dux/io.h @@ -1,37 +1,73 @@ /* - Copyright 2021, 2022 Gabriel Jensen. + Copyright 2019-2023 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 Lesser 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>. +*/ - 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. +#if !defined(dux_hdr_io) +#define dux_hdr_io - 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. +#include <dux/dux.h> - 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_prv_cdec + +typedef zp_i01 dux_prm; + +typedef enum { + dux_iomod_red, + dux_iomod_redwrt, + dux_iomod_wrt, +} dux_iomod; -enum dux_priv_iotyp { - dux_priv_iotyp_r, - dux_priv_iotyp_rw, - dux_priv_iotyp_w, +struct dux_prv_dsc { + bool _dsc; }; -# define dux_priv_ioacs_uid (dux_uint16l(04000)) -# define dux_priv_ioacs_gid (dux_uint16l(02000)) -# define dux_priv_ioacs_stck (dux_uint16l(01000)) -# define dux_priv_ioacs_usrr (dux_uint16l(0400)) -# define dux_priv_ioacs_usrw (dux_uint16l(0200)) -# define dux_priv_ioacs_usrx (dux_uint16l(0100)) -# define dux_priv_ioacs_grpr (dux_uint16l(040)) -# define dux_priv_ioacs_grpw (dux_uint16l(020)) -# define dux_priv_ioacs_grpx (dux_uint16l(010)) -# define dux_priv_ioacs_othr (dux_uint16l(04)) -# define dux_priv_ioacs_othw (dux_uint16l(02)) -# define dux_priv_ioacs_othx (dux_uint16l(01)) +#if zp_std_cxx +#define dux_kep (::dux_prv_dsc {false,}) +#define dux_dsc (::dux_prv_dsc {true,}) +#else +#define dux_kep ((struct dux_prv_dsc) {._dsc = false,}) +#define dux_dsc ((struct dux_prv_dsc) {._dsc = true,}) +#endif + +typedef struct { + zp_siz siz; + dux_prm prm; + bool isdir : 0x1; + bool isreg : 0x1; +} zp_pthinf; + +struct dux_prv_fil; +typedef struct dux_prv_fil dux_fil; + +extern dux_fil * dux_dfli; +extern dux_fil * dux_dflo; +extern dux_fil * dux_log; + +char const * dux_curdir(void); +char const * dux_homdir(void); + +dux_err dux_chgdir(char const * pth); + +dux_err dux_sttpth(char const * pth); +dux_err dux_setprm(char const * pth,dux_prm prm); + +dux_err dux_crtdir(char const * pth,dux_prm prm); + +dux_err dux_crtfil(dux_fil * * fil,char const * pth,dux_prm prm); + +dux_err dux_cpy(char const * newpth,char const * pth,dux_prm prm); +dux_err dux_mov(char const * newpth,char const * pth); +dux_err dux_rem(char const * pth); + +dux_err dux_wrt( dux_fil * fil,void const * dat,zp_siz num); +dux_err dux_wrtstr(dux_fil * fil,char const * str); +dux_err dux_red( void * buf,dux_fil * fil,zp_siz num,zp_siz * numrd); + +dux_prv_cdecend + +#endif diff --git a/dux/include/dux/math b/dux/include/dux/math deleted file mode 100644 index 882573d..0000000 --- a/dux/include/dux/math +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index f0456a6..0000000 --- a/dux/include/dux/math.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - 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 deleted file mode 100644 index 2f5b8e3..0000000 --- a/dux/include/dux/media +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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/dux/include/dux/media.h b/dux/include/dux/media.h deleted file mode 100644 index e3b7cd7..0000000 --- a/dux/include/dux/media.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - 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 - -extern bool const dux_priv_nomedia; - -dux_priv_endcdecls diff --git a/dux/include/dux/mem b/dux/include/dux/mem deleted file mode 100644 index cd01e1c..0000000 --- a/dux/include/dux/mem +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index 10e4243..0000000 --- a/dux/include/dux/mem.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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 deleted file mode 100644 index 6b75e74..0000000 --- a/dux/include/dux/seq +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index a7d3c2e..0000000 --- a/dux/include/dux/seq.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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 deleted file mode 100644 index 947b57b..0000000 --- a/dux/include/dux/sig +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index b01e279..0000000 --- a/dux/include/dux/sig.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - 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 deleted file mode 100644 index 218fa87..0000000 --- a/dux/include/dux/str +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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/dux/include/dux/str.d/isalnum.ii b/dux/include/dux/str.d/isalnum.ii deleted file mode 100644 index cc08476..0000000 --- a/dux/include/dux/str.d/isalnum.ii +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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 isalnum(char32_t const _chr) noexcept -> bool { - return ::dux::isalpha(_chr) || ::dux::isdigit(_chr); -} diff --git a/dux/include/dux/str.d/isalpha.ii b/dux/include/dux/str.d/isalpha.ii deleted file mode 100644 index 220774f..0000000 --- a/dux/include/dux/str.d/isalpha.ii +++ /dev/null @@ -1,180 +0,0 @@ -/* - 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 isalpha(char32_t const _chr) noexcept -> bool { - if(::dux::islower(_chr) || ::dux::isupper(_chr)) [[unlikely]] { - return true; - } - switch (_chr) { - [[likely]] default: - return false; - case U'\u0297': /* LATIN LETTER GLOTTAL STOP */ - [[fallthrough]]; - case U'\u16A0': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A1': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A2': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A3': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A4': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A5': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A6': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A7': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A8': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16A9': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AA': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AB': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AC': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AD': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AE': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16AF': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B0': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B1': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B2': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B3': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B4': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B5': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B6': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B7': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B8': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16B9': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BA': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BB': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BC': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BD': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BE': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16BF': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C0': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C1': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C2': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C3': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C4': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C5': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C6': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C7': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C8': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16C9': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CA': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CB': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CC': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CD': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CE': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16CF': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D0': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D1': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D2': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D3': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D4': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D5': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D6': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D7': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D8': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16D9': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DA': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DB': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DC': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DD': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DE': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16DF': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E0': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E1': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E2': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E3': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E4': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E5': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E6': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E7': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E8': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16E9': /* RUNIC LETTER FEHU FEOH FE F */ - [[fallthrough]]; - case U'\u16EA': /* RUNIC LETTER FEHU FEOH FE F */ - return true; - } -} diff --git a/dux/include/dux/str.d/iscntrl.ii b/dux/include/dux/str.d/iscntrl.ii deleted file mode 100644 index 2fa4ae8..0000000 --- a/dux/include/dux/str.d/iscntrl.ii +++ /dev/null @@ -1,169 +0,0 @@ -/* - 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 iscntrl(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0000': /* nullptr */ - [[fallthrough]]; - case U'\u0001': /* START OF HEADING */ - [[fallthrough]]; - case U'\u0002': /* START OF TEXT */ - [[fallthrough]]; - case U'\u0003': /* END OF TEXT */ - [[fallthrough]]; - case U'\u0004': /* END OF TRANSMISSION */ - [[fallthrough]]; - case U'\u0005': /* ENQUIRY */ - [[fallthrough]]; - case U'\u0006': /* ACKNOWLEDGE */ - [[fallthrough]]; - case U'\a': /* BELL */ - [[fallthrough]]; - case U'\b': /* BACKSPACE */ - [[fallthrough]]; - case U'\t': /* HORIZONTAL TABULATION */ - [[fallthrough]]; - case U'\n': /* ::new LINE */ - [[fallthrough]]; - case U'\v': /* VERTICAL TABULATION */ - [[fallthrough]]; - case U'\f': /* FORM FEED */ - [[fallthrough]]; - case U'\r': /* CARRIAGE RETURN */ - [[fallthrough]]; - case U'\u000E': /* SHIFT OUT */ - [[fallthrough]]; - case U'\u000F': /* SHIFT IN */ - [[fallthrough]]; - case U'\x10': /* DATA LINK ESCAPE */ - [[fallthrough]]; - case U'\x11': /* DEVICE CONTROL ONE */ - [[fallthrough]]; - case U'\x12': /* DEVICE CONTROL TWO */ - [[fallthrough]]; - case U'\x13': /* DEVICE CONTROL THREE */ - [[fallthrough]]; - case U'\x14': /* DEVICE CONTROL FOUR */ - [[fallthrough]]; - case U'\x15': /* NEGATIVE ACKNOWLEDGE */ - [[fallthrough]]; - case U'\x16': /* SYNCHRONOUS IDLE */ - [[fallthrough]]; - case U'\x17': /* END OF TRANSMISSION BLOCK */ - [[fallthrough]]; - case U'\x18': /* CANCEL */ - [[fallthrough]]; - case U'\x19': /* END OF MEDIUM */ - [[fallthrough]]; - case U'\x1A': /* SUBSTITUTE */ - [[fallthrough]]; - case U'\u001B': /* ESCAPE */ - [[fallthrough]]; - case U'\x1C': /* FILE SEPERATOR */ - [[fallthrough]]; - case U'\x1D': /* GROUP SEPERATOR */ - [[fallthrough]]; - case U'\x1E': /* RECORD SEPERATOR */ - [[fallthrough]]; - case U'\x1F': /* UNIT SEPERATOR */ - [[fallthrough]]; - case U'\x7F': /* ::delete */ - [[fallthrough]]; - case U'\x80': /* <CONTROL> */ - [[fallthrough]]; - case U'\x81': /* <CONTROL */ - [[fallthrough]]; - case U'\x82': /* BREAK PERMITTED HERE */ - [[fallthrough]]; - case U'\x83': /* NO BREAK HERE */ - [[fallthrough]]; - case U'\x84': /* INDEX */ - [[fallthrough]]; - case U'\x85': /* NEXT LINE */ - [[fallthrough]]; - case U'\x86': /* START OF SELECTED AREA */ - [[fallthrough]]; - case U'\x87': /* END OF SELECTED AREA */ - [[fallthrough]]; - case U'\x88': /* CHARACTER TABULATION SET */ - [[fallthrough]]; - case U'\x89': /* CHARACTER TABULATION SET WITH JUSTIFICATION */ - [[fallthrough]]; - case U'\x8A': /* LINE TABULATION SET */ - [[fallthrough]]; - case U'\x8B': /* PARTIAL LINE FORWARD */ - [[fallthrough]]; - case U'\x8C': /* PARTIAL LINE BACKWARD */ - [[fallthrough]]; - case U'\x8D': /* REVERSE LINE FEED */ - [[fallthrough]]; - case U'\x8E': /* SINGLE SHIFT TWO */ - [[fallthrough]]; - case U'\x8F': /* SINGLE SHIFT THREE */ - [[fallthrough]]; - case U'\x90': /* DEVICE CONTROL STRING */ - [[fallthrough]]; - case U'\x91': /* PRIVATE USE ONE */ - [[fallthrough]]; - case U'\x92': /* PRIVATE USE TWO */ - [[fallthrough]]; - case U'\x93': /* SET TRANSMIT STATE */ - [[fallthrough]]; - case U'\x94': /* CANCEL CHARACTER */ - [[fallthrough]]; - case U'\x95': /* MESSAGE WAITING */ - [[fallthrough]]; - case U'\x96': /* START OF GUARDED AREA */ - [[fallthrough]]; - case U'\x97': /* END OF GUARDED AREA */ - [[fallthrough]]; - case U'\x98': /* START OF STRING */ - [[fallthrough]]; - case U'\x99': /* <CONTROL> */ - [[fallthrough]]; - case U'\x9A': /* SINGLE CHARACTER INTRODUCER */ - [[fallthrough]]; - case U'\x9B': /* CONTROL SEQUENCE INTRODUCER */ - [[fallthrough]]; - case U'\x9C': /* STRING TERMINATOR */ - [[fallthrough]]; - case U'\x9D': /* OPERATING SYSTEM COMMAND */ - [[fallthrough]]; - case U'\x9E': /* PRIVACY MESSAGE */ - [[fallthrough]]; - case U'\x9F': /* APPLICATION PROGRAM COMMAND */ - [[fallthrough]]; - case U'\xA0': /* NO-BREAK SPACE */ - [[fallthrough]]; - case U'\u2028': /* LINE SEPERATOR */ - [[fallthrough]]; - case U'\u2029': /* PARAGRAPH SEPERATOR */ - [[fallthrough]]; - case U'\u202D': /* LEFT-TO-RIGHT OVERRIDE */ - [[fallthrough]]; - case U'\u202E': /* RIGHT-TO-LEFT OVERRIDE */ - [[fallthrough]]; - case U'\u2068': /* FIRST STRONG ISOLATE */ - [[fallthrough]]; - case U'\u2069': /* POP DIRECTIONAL ISOLATE */ - return true; - } -} diff --git a/dux/include/dux/str.d/isdigit.ii b/dux/include/dux/str.d/isdigit.ii deleted file mode 100644 index 12875e8..0000000 --- a/dux/include/dux/str.d/isdigit.ii +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 isdigit(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0030': /* DIGIT ZERO */ - [[fallthrough]]; - case U'\u0031': /* DIGIT ONE */ - [[fallthrough]]; - case U'\u0032': /* DIGIT TWO */ - [[fallthrough]]; - case U'\u0033': /* DIGIT THREE */ - [[fallthrough]]; - case U'\u0034': /* DIGIT FOUR */ - [[fallthrough]]; - case U'\u0035': /* DIGIT FIVE */ - [[fallthrough]]; - case U'\u0036': /* DIGIT SIX */ - [[fallthrough]]; - case U'\u0037': /* DIGIT SEVEN */ - [[fallthrough]]; - case U'\u0038': /* DIGIT EIGHT */ - [[fallthrough]]; - case U'\u0039': /* DIGIT NINE */ - [[fallthrough]]; - case U'\u218A': /* TURNED DIGIT TWO */ - [[fallthrough]]; - case U'\u218B': /* TURNED DIGIT THREE */ - return true; - } -} diff --git a/dux/include/dux/str.d/islower.ii b/dux/include/dux/str.d/islower.ii deleted file mode 100644 index e02e800..0000000 --- a/dux/include/dux/str.d/islower.ii +++ /dev/null @@ -1,335 +0,0 @@ -/* - 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 islower(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0061': /* LATIN SMALL LETTER A */ - [[fallthrough]]; - case U'\u0062': /* LATIN SMALL LETTER B */ - [[fallthrough]]; - case U'\u0063': /* LATIN SMALL LETTER C */ - [[fallthrough]]; - case U'\u0064': /* LATIN SMALL LETTER D */ - [[fallthrough]]; - case U'\u0065': /* LATIN SMALL LETTER E */ - [[fallthrough]]; - case U'\u0066': /* LATIN SMALL LETTER F */ - [[fallthrough]]; - case U'\u0067': /* LATIN SMALL LETTER G */ - [[fallthrough]]; - case U'\u0068': /* LATIN SMALL LETTER H */ - [[fallthrough]]; - case U'\u0069': /* LATIN SMALL LETTER I */ - [[fallthrough]]; - case U'\u006A': /* LATIN SMALL LETTER J */ - [[fallthrough]]; - case U'\u006B': /* LATIN SMALL LETTER K */ - [[fallthrough]]; - case U'\u006C': /* LATIN SMALL LETTER L */ - [[fallthrough]]; - case U'\u006D': /* LATIN SMALL LETTER M */ - [[fallthrough]]; - case U'\u006E': /* LATIN SMALL LETTER N */ - [[fallthrough]]; - case U'\u006F': /* LATIN SMALL LETTER O */ - [[fallthrough]]; - case U'\u0070': /* LATIN SMALL LETTER P */ - [[fallthrough]]; - case U'\u0071': /* LATIN SMALL LETTER Q */ - [[fallthrough]]; - case U'\u0072': /* LATIN SMALL LETTER R */ - [[fallthrough]]; - case U'\u0073': /* LATIN SMALL LETTER S */ - [[fallthrough]]; - case U'\u0074': /* LATIN SMALL LETTER T */ - [[fallthrough]]; - case U'\u0075': /* LATIN SMALL LETTER U */ - [[fallthrough]]; - case U'\u0076': /* LATIN SMALL LETTER V */ - [[fallthrough]]; - case U'\u0077': /* LATIN SMALL LETTER W */ - [[fallthrough]]; - case U'\u0078': /* LATIN SMALL LETTER X */ - [[fallthrough]]; - case U'\u0079': /* LATIN SMALL LETTER Y */ - [[fallthrough]]; - case U'\u007A': /* LATIN SMALL LETTER Z */ - [[fallthrough]]; - case U'\u00DF': /* LATIN SMALL LETTER SHARP S */ - [[fallthrough]]; - case U'\u00E0': /* LATIN SMALL LETTER A WITH GRAVE */ - [[fallthrough]]; - case U'\u00E1': /* LATIN SMALL LETTER A WITH ACUTE */ - [[fallthrough]]; - case U'\u00E2': /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00E3': /* LATIN SMALL LETTER A WITH TILDE */ - [[fallthrough]]; - case U'\u00E4': /* LATIN SMALL LETTER A WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00E5': /* LATIN SMALL LETTER A WITH RING ABOVE */ - [[fallthrough]]; - case U'\u00E6': /* LATIN SMALL LETTER AE */ - [[fallthrough]]; - case U'\u00E7': /* LATIN SMALL LETTER C WITH CEDILLA */ - [[fallthrough]]; - case U'\u00E8': /* LATIN SMALL LETTER E WITH GRAVE */ - [[fallthrough]]; - case U'\u00E9': /* LATIN SMALL LETTER E WITH ACUTE */ - [[fallthrough]]; - case U'\u00EA': /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00EB': /* LATIN SMALL LETTER E WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00EC': /* LATIN SMALL LETTER I WITH GRAVE */ - [[fallthrough]]; - case U'\u00ED': /* LATIN SMALL LETTER I WITH ACUTE */ - [[fallthrough]]; - case U'\u00EE': /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00EF': /* LATIN SMALL LETTER I WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00F0': /* LATIN SMALL LETTER ETH */ - [[fallthrough]]; - case U'\u00F1': /* LATIN SMALL LETTER N WITH TILDE */ - [[fallthrough]]; - case U'\u00F2': /* LATIN SMALL LETTER O WITH GRAVE */ - [[fallthrough]]; - case U'\u00F3': /* LATIN SMALL LETTER O WITH ACUTE */ - [[fallthrough]]; - case U'\u00F4': /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00F5': /* LATIN SMALL LETTER O WITH TILDE */ - [[fallthrough]]; - case U'\u00F6': /* LATIN SMALL LETTER O WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00F8': /* LATIN SMALL LETTER O WITH STROKE */ - [[fallthrough]]; - case U'\u00F9': /* LATIN SMALL LETTER U WITH GRAVE */ - [[fallthrough]]; - case U'\u00FA': /* LATIN SMALL LETTER U WITH ACUTE */ - [[fallthrough]]; - case U'\u00FB': /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00FC': /* U WITH TWO DOTS */ - [[fallthrough]]; - case U'\u00FD': /* LATIN SMALL LETTER Y WITH ACUTE */ - [[fallthrough]]; - case U'\u00FE': /* LATIN SMALL LETTER THORN */ - [[fallthrough]]; - case U'\u00FF': /* LATIN SMALL LETTER Y WITH DIAERESIS */ - [[fallthrough]]; - case U'\u0105': /* LATIN SMALL LETTER A WITH OGONEK */ - [[fallthrough]]; - case U'\u0107': /* LATIN SMALL LETTER C WITH ACUTE */ - [[fallthrough]]; - case U'\u010D': /* LATIN SMALL LETTER C WITH CARON */ - [[fallthrough]]; - case U'\u010F': /* LATIN SMALL LETTER D WITH CARON */ - [[fallthrough]]; - case U'\u0119': /* LATIN SMALL LETTER E WITH OGONEK */ - [[fallthrough]]; - case U'\u011B': /* LATIN SMALL LETTER E WITH CARON */ - [[fallthrough]]; - case U'\u011F': /* LATIN SMALL LETTER G WITH BREVE */ - [[fallthrough]]; - case U'\u0131': /* LATIN SMALL LETTER DOTLESS I */ - [[fallthrough]]; - case U'\u0133': /* LATIN SMALL LIGATURE IJ */ - [[fallthrough]]; - case U'\u0138': /* LATIN SMALL LETTER KRA */ - [[fallthrough]]; - case U'\u0142': /* LATIN SMALL LETTER L WITH STROKE */ - [[fallthrough]]; - case U'\u0144': /* LATIN SMALL LETTER N WITH ACUTE */ - [[fallthrough]]; - case U'\u0148': /* LATIN SMALL LETTER N WITH CARON */ - [[fallthrough]]; - case U'\u014B': /* LATIN SMALL LETTER ENG */ - [[fallthrough]]; - case U'\u0153': /* LATIN SMALL LIGATURE OE */ - [[fallthrough]]; - case U'\u0159': /* LATIN SMALL LETTER R WITH CARON */ - [[fallthrough]]; - case U'\u015B': /* LATIN SMALL LETTER S WITH ACUTE */ - [[fallthrough]]; - case U'\u015F': /* LATIN SMALL LETTER S WITH CEDILLA */ - [[fallthrough]]; - case U'\u0161': /* LATIN SMALL LETTER S WITH CARON */ - [[fallthrough]]; - case U'\u0165': /* LATIN SMALL LETTER T WITH CARON */ - [[fallthrough]]; - case U'\u016F': /* LATIN SMALL LETTER U WITH RING ABOVE */ - [[fallthrough]]; - case U'\u017A': /* LATIN SMALL LETTER Z WITH ACUTE */ - [[fallthrough]]; - case U'\u017C': /* LATIN SMALL LETTER Z WITH DOT ABOVE */ - [[fallthrough]]; - case U'\u017E': /* LATIN SMALL LETTER Z WITH CARON */ - [[fallthrough]]; - case U'\u01BF': /* LATIN LETTER WYNN */ - [[fallthrough]]; - case U'\u01DD': /* LATIN SMALL LETTER TURNED E */ - [[fallthrough]]; - case U'\u021D': /* LATIN SMALL LETTER YOGH */ - [[fallthrough]]; - case U'\u0242': /* LATIN SMALL LETTER GLOTTAL STOP */ - [[fallthrough]]; - case U'\u0250': /* LATIN SMALL LETTER TURNED A */ - [[fallthrough]]; - case U'\u0251': /* LATIN SMALL LETTER ALPHA */ - [[fallthrough]]; - case U'\u0252': /* LATIN SMALL LETTER TURNED ALPHA */ - [[fallthrough]]; - case U'\u0253': /* LATIN SMALL LETTER B WITH HOOk */ - [[fallthrough]]; - case U'\u0254': /* LATIN SMALL LETTER OPEN O */ - [[fallthrough]]; - case U'\u0255': /* LATIN SMALL LETTER C WITH CURL */ - [[fallthrough]]; - case U'\u0256': /* LATIN SMALL LETTER D WITH TAIL */ - [[fallthrough]]; - case U'\u0257': /* LATIN SMALL LETTER D WITH HOOk */ - [[fallthrough]]; - case U'\u0258': /* LATIN SMALL LETTER REVERSED E */ - [[fallthrough]]; - case U'\u0259': /* LATIN SMALL LETTER SCHWA */ - [[fallthrough]]; - case U'\u025A': /* LATIN SMALL LETTER SCHWA WITH HOOK */ - [[fallthrough]]; - case U'\u025B': /* LATIN SMALL LETTER OPEN E */ - [[fallthrough]]; - case U'\u025C': /* LATIN SMALL LETTER REVERSED OPEN E */ - [[fallthrough]]; - case U'\u025D': /* LATIN SMALL LETTER REVERSED OPEN E WITH HOOK */ - [[fallthrough]]; - case U'\u025E': /* LATIN SMALL LETTER CLOSED REVERSED OPEN E */ - [[fallthrough]]; - case U'\u025F': /* LATIN SMALL LETTER DOTLESS J WITH STROKE */ - [[fallthrough]]; - case U'\u0260': /* LATIN SMALL LETTER G WITH HOOK */ - [[fallthrough]]; - case U'\u0261': /* LATIN SMALL LETTER SCRIPT G */ - [[fallthrough]]; - case U'\u0262': /* LATIN LETTER SMALL CAPITAL G */ - [[fallthrough]]; - case U'\u0263': /* LATIN SMALL LETTER GAMMA */ - [[fallthrough]]; - case U'\u0264': /* LATIN SMALL LETTER RAMS HORN */ - [[fallthrough]]; - case U'\u0265': /* LATIN SMALL LETTER TURNED H */ - [[fallthrough]]; - case U'\u0266': /* LATIN SMALL LETTER H WITH HOOK */ - [[fallthrough]]; - case U'\u0267': /* LATIN SMALL LETTER HENG WITH HOOK */ - [[fallthrough]]; - case U'\u0268': /* LATIN SMALL LETTER I WITH STROKE */ - [[fallthrough]]; - case U'\u0269': /* LATIN SMALL LETTER IOTA */ - [[fallthrough]]; - case U'\u026A': /* LATIN LETTER SMALL CAPITAL I */ - [[fallthrough]]; - case U'\u026B': /* LATIN SMALL LETTER L WITH MIDDLE TILDE */ - [[fallthrough]]; - case U'\u026C': /* LATIN SMALL LETTER L WITH BELT */ - [[fallthrough]]; - case U'\u026D': /* LATIN SMALL LETTER L WITH RETROFLEX HOOK */ - [[fallthrough]]; - case U'\u026E': /* LATIN SMALL LETTER LEZH */ - [[fallthrough]]; - case U'\u026F': /* LATIN SMALL LETTER TURNED M */ - [[fallthrough]]; - case U'\u0270': /* LATIN SMALL LETTER TURNED M WITH LONG LEG */ - [[fallthrough]]; - case U'\u0271': /* LATIN SMALL LETTER M WITH HOOK */ - [[fallthrough]]; - case U'\u0272': /* LATIN SMALL LETTER N WITH LEFT HOOK */ - [[fallthrough]]; - case U'\u0273': /* LATIN SMALL LETTER N WITH RETROFLEX HOOK */ - [[fallthrough]]; - case U'\u0283': /* LATIN SMALL LETTER ESH */ - [[fallthrough]]; - case U'\u028A': /* LATIN SMALL LETTER UPSILON */ - [[fallthrough]]; - case U'\u028B': /* LATIN SMALL LETTER V WITH HOOK */ - [[fallthrough]]; - case U'\u0292': /* LATIN SMALL LETTER EZH */ - [[fallthrough]]; - case U'\u0294': /* LATIN SMALL LETTER GLOTTAL STOP */ - [[fallthrough]]; - case U'\u03B1': /* GREEK SMALL LETTER ALPHA */ - [[fallthrough]]; - case U'\u03B2': /* GREEK SMALL LETTER BETA */ - [[fallthrough]]; - case U'\u03B3': /* GREEK SMALL LETTER GAMMA */ - [[fallthrough]]; - case U'\u03B4': /* GREEK SMALL LETTER DELTA */ - [[fallthrough]]; - case U'\u03B5': /* GREEK SMALL LETTER EPSILON */ - [[fallthrough]]; - case U'\u03B6': /* GREEK SMALL LETTER ZETA */ - [[fallthrough]]; - case U'\u03B7': /* GREEK SMALL LETTER ETA */ - [[fallthrough]]; - case U'\u03B8': /* GREEK SMALL LETTER THETA */ - [[fallthrough]]; - case U'\u03B9': /* GREEK SMALL LETTER IOTA */ - [[fallthrough]]; - case U'\u03BA': /* GREEK SMALL LETTER KAPPA */ - [[fallthrough]]; - case U'\u03BB': /* GREEK SMALL LETTER LAMBDA */ - [[fallthrough]]; - case U'\u03BC': /* GREEK SMALL LETTER MU */ - [[fallthrough]]; - case U'\u03BD': /* GREEK SMALL LETTER NU */ - [[fallthrough]]; - case U'\u03BE': /* GREEK SMALL LETTER XI */ - [[fallthrough]]; - case U'\u03BF': /* GREEK SMALL LETTER OMICRON */ - [[fallthrough]]; - case U'\u03C0': /* GREEK SMALL LETTER PI */ - [[fallthrough]]; - case U'\u03C1': /* GREEK SMALL LETTER RHO */ - [[fallthrough]]; - case U'\u03C2': /* GREEK SMALL LETTER FINAL SIGMA */ - [[fallthrough]]; - case U'\u03C3': /* GREEK SMALL LETTER SIGMA */ - [[fallthrough]]; - case U'\u03C4': /* GREEK SMALL LETTER TAU */ - [[fallthrough]]; - case U'\u03C5': /* GREEK SMALL LETTER UPSILON */ - [[fallthrough]]; - case U'\u03C6': /* GREEK SMALL LETTER PHI */ - [[fallthrough]]; - case U'\u03C7': /* GREEK SMALL LETTER CHI */ - [[fallthrough]]; - case U'\u03C8': /* GREEK SMALL LETTER PSI */ - [[fallthrough]]; - case U'\u03C9': /* GREEK SMALL LETTER OMEGA */ - [[fallthrough]]; - case U'\u1D79': /* LATIN SMALL LETTER INSULAR G */ - [[fallthrough]]; - case U'\uA7B7': /* LATIN SMALL LETTER OMEGA */ - [[fallthrough]]; - case U'\uFB00': /* LATIN SMALL LIGATURE FF */ - return true; - } -} diff --git a/dux/include/dux/str.d/ispunct.ii b/dux/include/dux/str.d/ispunct.ii deleted file mode 100644 index 90d62ec..0000000 --- a/dux/include/dux/str.d/ispunct.ii +++ /dev/null @@ -1,319 +0,0 @@ -/* - 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 ispunct(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0021': /* EXCLAMATION MARK */ - [[fallthrough]]; - case U'\u0022': /* QUOTATION MARK */ - [[fallthrough]]; - case U'\u0023': /* NUMBER SIGN */ - [[fallthrough]]; - case U'\u0024': /* DOLLAR SIGN */ - [[fallthrough]]; - case U'\u0025': /* PERCENT SIGN */ - [[fallthrough]]; - case U'\u0026': /* AMPERSAND */ - [[fallthrough]]; - case U'\u0027': /* APOSTROPHE */ - [[fallthrough]]; - case U'\u0028': /* LEFT PARANTHESIS */ - [[fallthrough]]; - case U'\u0029': /* RIGHT PARANTHESIS */ - [[fallthrough]]; - case U'\u002A': /* ASTERISK */ - [[fallthrough]]; - case U'\u002B': /* PLUS SIGN */ - [[fallthrough]]; - case U'\u002C': /* COMMA */ - [[fallthrough]]; - case U'\u002D': /* HYPHEN-MINUS */ - [[fallthrough]]; - case U'\u002E': /* FULL STOP */ - [[fallthrough]]; - case U'\u002F': /* SOLIDUS */ - [[fallthrough]]; - case U'\u003A': /* COLON */ - [[fallthrough]]; - case U'\u003B': /* SEMICOLON */ - [[fallthrough]]; - case U'\u003C': /* LESS-THAN SIGN */ - [[fallthrough]]; - case U'\u003D': /* EQUALS SIGN */ - [[fallthrough]]; - case U'\u003E': /* GREATER-THAN SIGN */ - [[fallthrough]]; - case U'\u003F': /* QUESTION MARK */ - [[fallthrough]]; - case U'\u0040': /* COMMERCIAL AT */ - [[fallthrough]]; - case U'\u005B': /* LEFT SQUARE BRACKET */ - [[fallthrough]]; - case U'\u005C': /* REVERSE SOLIDUS */ - [[fallthrough]]; - case U'\u005D': /* RIGHT SQUARE BRACKET */ - [[fallthrough]]; - case U'\u005E': /* CIRCUMFLEX ACCENT */ - [[fallthrough]]; - case U'\u005F': /* LOW LINE */ - [[fallthrough]]; - case U'\u0060': /* GRAVE ACCENT */ - [[fallthrough]]; - case U'\u007B': /* LEFT CURLY BRACKET */ - [[fallthrough]]; - case U'\u007C': /* VERTICAL LINE */ - [[fallthrough]]; - case U'\u007D': /* RIGHT CURLY BRACKET */ - [[fallthrough]]; - case U'\u007E': /* TILDE */ - [[fallthrough]]; - case U'\u00A1': /* INVERT EXCLAMATION MARK */ - [[fallthrough]]; - case U'\u00A2': /* CENT SIGN */ - [[fallthrough]]; - case U'\u00A3': /* POUND SIGN */ - [[fallthrough]]; - case U'\u00A4': /* CURRENCY SIGN */ - [[fallthrough]]; - case U'\u00A5': /* YEN SIGN */ - [[fallthrough]]; - case U'\u00A6': /* BROKEN BAR */ - [[fallthrough]]; - case U'\u00A7': /* SECTION SIGN */ - [[fallthrough]]; - case U'\u00A8': /* DIAERESIS */ - [[fallthrough]]; - case U'\u00A9': /* COPYRIGHT SIGN */ - [[fallthrough]]; - case U'\u00AA': /* FEMININE ORDINAL INDICATOR */ - [[fallthrough]]; - case U'\u00AB': /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u00AC': /* NOT SIGN */ - [[fallthrough]]; - case U'\u00AE': /* REGISTERED SIGN */ - [[fallthrough]]; - case U'\u00AF': /* MACRON */ - [[fallthrough]]; - case U'\u00B0': /* DEGREE SIGN */ - [[fallthrough]]; - case U'\u00B1': /* PLUS MINUS SYMBOL */ - [[fallthrough]]; - case U'\u00B2': /* SUPERSCRIPT TWO */ - [[fallthrough]]; - case U'\u00B3': /* SUPERSCRIPT THREE */ - [[fallthrough]]; - case U'\u00B4': /* ACUTE ACCENT */ - [[fallthrough]]; - case U'\u00B5': /* MICRO SIGN */ - [[fallthrough]]; - case U'\u00B6': /* PILCROW SIGN */ - [[fallthrough]]; - case U'\u00B7': /* MIDDLE DOT */ - [[fallthrough]]; - case U'\u00B8': /* CEDILLA */ - [[fallthrough]]; - case U'\u00B9': /* SUPERSCRIPT ONE */ - [[fallthrough]]; - case U'\u00BA': /* MASCULINE ORDINAL INDICATOR */ - [[fallthrough]]; - case U'\u00BB': /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u00BC': /* VULGAR FRACTION ONE QUARTER */ - [[fallthrough]]; - case U'\u00BD': /* VULGAR FRACTION ONE HALF */ - [[fallthrough]]; - case U'\u00BE': /* VULGAR FRACTION THREE QUARTERS */ - [[fallthrough]]; - case U'\u00BF': /* INVERT QUESTION MARK */ - [[fallthrough]]; - case U'\u00D7': /* MULTIPLICATION SIGN */ - [[fallthrough]]; - case U'\u00F7': /* DIVISION SIGN */ - [[fallthrough]]; - case U'\u2010': /* HYPHEN */ - [[fallthrough]]; - case U'\u2013': /* EN DASH */ - [[fallthrough]]; - case U'\u2014': /* EM DASH */ - [[fallthrough]]; - case U'\u2018': /* LEFT SINGLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u2019': /* RIGHT SINGLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u201C': /* LEFT DOUBLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u201D': /* RIGHT DOUBLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u2026': /* HORIZONTAL ELLIPSIS */ - [[fallthrough]]; - case U'\u2030': /* PER MILLE SIGN */ - [[fallthrough]]; - case U'\u2031': /* PER TEN THOUSAND SIGN */ - [[fallthrough]]; - case U'\u2032': /* PRIME */ - [[fallthrough]]; - case U'\u2033': /* DOUBLE PRIME */ - [[fallthrough]]; - case U'\u2034': /* TRIPLE PRIME */ - [[fallthrough]]; - case U'\u2035': /* REVERSED PRIME */ - [[fallthrough]]; - case U'\u2036': /* REVERSED DOUBLE PRIME */ - [[fallthrough]]; - case U'\u2037': /* REVERSED TRIPLE PRIME */ - [[fallthrough]]; - case U'\u203C': /* DOUBLE EXCLAMATION MARK */ - [[fallthrough]]; - case U'\u203D': /* INTERROBANG */ - [[fallthrough]]; - case U'\u2047': /* DOUBLE QUOTATION MARK */ - [[fallthrough]]; - case U'\u2048': /* QUESTION EXCLAMATION MARK */ - [[fallthrough]]; - case U'\u2049': /* EXCLAMATION QUESTION MARK */ - [[fallthrough]]; - case U'\u20A3': /* FRENCH FRANC SIGN */ - [[fallthrough]]; - case U'\u20A4': /* LIRA SIGN */ - [[fallthrough]]; - case U'\u20A8': /* RUPEE SIGN */ - [[fallthrough]]; - case U'\u20A9': /* WON SIGN */ - [[fallthrough]]; - case U'\u20AC': /* EURO SIGN */ - [[fallthrough]]; - case U'\u20B9': /* INDIAN RUPEE SIGN */ - [[fallthrough]]; - case U'\u20BF': /* BITCOIN SIGN */ - [[fallthrough]]; - case U'\u2103': /* DEGREE CELSIUS */ - [[fallthrough]]; - case U'\u2107': /* EULER CONSTANT */ - [[fallthrough]]; - case U'\u2109': /* DEGREE FAHRENHEIT */ - [[fallthrough]]; - case U'\u210E': /* PLANCK CONSTANT */ - [[fallthrough]]; - case U'\u2117': /* SOUND RECORDING COPYRIGHT */ - [[fallthrough]]; - case U'\u2122': /* TRADE MARK SIGN */ - [[fallthrough]]; - case U'\u2125': /* OUNCE SIGN */ - [[fallthrough]]; - case U'\u2126': /* OHM SIGN */ - [[fallthrough]]; - case U'\u212A': /* KELVIN SIGN */ - [[fallthrough]]; - case U'\u214D': /* AKTIESELSKAB */ - [[fallthrough]]; - case U'\u2205': /* EMPTY SET */ - [[fallthrough]]; - case U'\u2212': /* MINUS SIGN */ - [[fallthrough]]; - case U'\u221A': /* SQUARE ROOT */ - [[fallthrough]]; - case U'\u221B': /* CUBE ROOT */ - [[fallthrough]]; - case U'\u221C': /* FOURTH ROOT */ - [[fallthrough]]; - case U'\u221E': /* INFINITY */ - [[fallthrough]]; - case U'\u2228': /* LOGICAL OR */ - [[fallthrough]]; - case U'\u2248': /* ALMOST EQUAL TO */ - [[fallthrough]]; - case U'\u2260': /* NOT EQUAL TO */ - [[fallthrough]]; - case U'\u2264': /* LESS-THAN OR EQUAL TO */ - [[fallthrough]]; - case U'\u2265': /* GREATER-THAN OR EQUAL TO */ - [[fallthrough]]; - case U'\u2609': /* SUN */ - [[fallthrough]]; - case U'\u263F': /* MERCURY */ - [[fallthrough]]; - case U'\u2640': /* FEMALE SIGN */ - [[fallthrough]]; - case U'\u2641': /* EARTH */ - [[fallthrough]]; - case U'\u2642': /* MALE SIGN */ - [[fallthrough]]; - case U'\u2643': /* JUPITER */ - [[fallthrough]]; - case U'\u2644': /* SATURN */ - [[fallthrough]]; - case U'\u2645': /* URANUS */ - [[fallthrough]]; - case U'\u2646': /* NEPTUNE */ - [[fallthrough]]; - case U'\u2647': /* PLUTO */ - [[fallthrough]]; - case U'\u26A2': /* DOUBLED FEMALE SIGN */ - [[fallthrough]]; - case U'\u26A3': /* DOUBLED MALE SIGN */ - [[fallthrough]]; - case U'\u26A4': /* INTERLOCKED FEMALE AND MALE SIGN */ - [[fallthrough]]; - case U'\u26A5': /* MALE AND FEMALE SIGN */ - [[fallthrough]]; - case U'\u26B3': /* CERES */ - [[fallthrough]]; - case U'\u26B4': /* PALLAS */ - [[fallthrough]]; - case U'\u26B5': /* JUNO */ - [[fallthrough]]; - case U'\u26B6': /* VESTA */ - [[fallthrough]]; - case U'\u26B7': /* CHIRON */ - [[fallthrough]]; - case U'\u2BD8': /* PROSERPINA */ - [[fallthrough]]; - case U'\u2BD9': /* ASTRAEA */ - [[fallthrough]]; - case U'\u2BDA': /* HYGIEA */ - [[fallthrough]]; - case U'\u2BDB': /* PHOLOS */ - [[fallthrough]]; - case U'\u2BDC': /* NESSUS */ - [[fallthrough]]; - case U'\u2E2E': /* INVERTED QUESTION MARK */ - [[fallthrough]]; - case U'\u33D7': /* SQUARE PH */ - [[fallthrough]]; - case U'\uFDFC': /* RIAL SIGN */ - [[fallthrough]]; - case U'\U0001F10D': /* CIRCLED ZERO WITH SLASH */ - [[fallthrough]]; - case U'\U0001F10E': /* CIRCLED ANTICKLOCKWISE ARROW */ - [[fallthrough]]; - case U'\U0001F10F': /* CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH */ - [[fallthrough]]; - case U'\U0001F12F': /* COPYLEFT SYMBOL */ - [[fallthrough]]; - case U'\U0001F16D': /* CIRCLED CC */ - [[fallthrough]]; - case U'\U0001F16E': /* CIRCLED C WITH OVERLAID BACKSLASH */ - [[fallthrough]]; - case U'\U0001F16F': /* CIRCLED HUMAN FIGURE */ - return true; - } -} diff --git a/dux/include/dux/str.d/isspace.ii b/dux/include/dux/str.d/isspace.ii deleted file mode 100644 index 80ba39f..0000000 --- a/dux/include/dux/str.d/isspace.ii +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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 isspace(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0009': /* HORIZONTAL TABULATION */ - [[fallthrough]]; - case U'\u000A': /* ::new LINE */ - [[fallthrough]]; - case U'\u000B': /* VERTICAL TABULATION */ - [[fallthrough]]; - case U'\u000C': /* FORM FEED */ - [[fallthrough]]; - case U'\u000D': /* CARRIAGE RETURN */ - [[fallthrough]]; - case U'\u0020': /* SPACE */ - return true; - } -} diff --git a/dux/include/dux/str.d/issurro.ii b/dux/include/dux/str.d/issurro.ii deleted file mode 100644 index ebf3b50..0000000 --- a/dux/include/dux/str.d/issurro.ii +++ /dev/null @@ -1,25 +0,0 @@ -/* - 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 issurro(char32_t const _chr) noexcept -> bool { - if(_chr >= U'\xD800' && _chr <= U'\xDFFF') [[unlikely]] { - return true; - } - return false; -} diff --git a/dux/include/dux/str.d/isupper.ii b/dux/include/dux/str.d/isupper.ii deleted file mode 100644 index 470ab7c..0000000 --- a/dux/include/dux/str.d/isupper.ii +++ /dev/null @@ -1,255 +0,0 @@ -/* - 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 isupper(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - case U'\u0041': /* LATIN CAPITAL LETTER A */ - [[fallthrough]]; - case U'\u0042': /* LATIN CAPITAL LETTER B */ - [[fallthrough]]; - case U'\u0043': /* LATIN CAPITAL LETTER C */ - [[fallthrough]]; - case U'\u0044': /* LATIN CAPITAL LETTER D */ - [[fallthrough]]; - case U'E': /* LATIN CAPITAL LETTER E */ - [[fallthrough]]; - case U'F': /* LATIN CAPITAL LETTER F */ - [[fallthrough]]; - case U'G': /* LATIN CAPITAL LETTER G */ - [[fallthrough]]; - case U'H': /* LATIN CAPITAL LETTER H */ - [[fallthrough]]; - case U'I': /* LATIN CAPITAL LETTER I */ - [[fallthrough]]; - case U'J': /* LATIN CAPITAL LETTER J */ - [[fallthrough]]; - case U'K': /* LATIN CAPITAL LETTER K */ - [[fallthrough]]; - case U'L': /* LATIN CAPITAL LETTER L */ - [[fallthrough]]; - case U'M': /* LATIN CAPITAL LETTER M */ - [[fallthrough]]; - case U'N': /* LATIN CAPITAL LETTER N */ - [[fallthrough]]; - case U'O': /* LATIN CAPITAL LETTER O */ - [[fallthrough]]; - case U'P': /* LATIN CAPITAL LETTER P */ - [[fallthrough]]; - case U'Q': /* LATIN CAPITAL LETTER Q */ - [[fallthrough]]; - case U'R': /* LATIN CAPITAL LETTER R */ - [[fallthrough]]; - case U'S': /* LATIN CAPITAL LETTER S */ - [[fallthrough]]; - case U'T': /* LATIN CAPITAL LETTER T */ - [[fallthrough]]; - case U'U': /* LATIN CAPITAL LETTER U */ - [[fallthrough]]; - case U'V': /* LATIN CAPITAL LETTER V */ - [[fallthrough]]; - case U'X': /* LATIN CAPITAL LETTER Y */ - [[fallthrough]]; - case U'W': /* LATIN CAPITAL LETTER X */ - [[fallthrough]]; - case U'Y': /* LATIN CAPITAL LETTER Y */ - [[fallthrough]]; - case U'Z': /* LATIN CAPITAL LETTER Z */ - [[fallthrough]]; - case U'\u00C0': /* LATIN CAPITAL LETTER A WITH GRAVE */ - [[fallthrough]]; - case U'\u00C1': /* LATIN CAPITAL LETTER A WITH ACUTE */ - [[fallthrough]]; - case U'\u00C2': /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00C3': /* LATIN CAPITAL LETTER A WITH TILDE */ - [[fallthrough]]; - case U'\u00C4': /* LATIN CAPITAL LETTER A WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00C5': /* LATIN CAPITAL LETTER A WITH RING ABOVE */ - [[fallthrough]]; - case U'\u00C6': /* LATIN CAPITAL LETTER AE */ - [[fallthrough]]; - case U'\u00C7': /* LATIN CAPITAL LETTER C WITH CEDILLA */ - [[fallthrough]]; - case U'\u00C8': /* LATIN CAPITAL LETTER E WITH GRAVE */ - [[fallthrough]]; - case U'\u00C9': /* LATIN CAPITAL LETTER E WITH ACUTE */ - [[fallthrough]]; - case U'\u00CA': /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00CB': /* LATIN CAPITAL LETTER E WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00CC': /* LATIN CAPITAL LETTER I WITH GRAVE */ - [[fallthrough]]; - case U'\u00CD': /* LATIN CAPITAL LETTER I WITH ACUTE */ - [[fallthrough]]; - case U'\u00CE': /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00CF': /* LATIN CAPITAL LETTER I WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00D0': /* LATIN CAPITAL LETTER ETH */ - [[fallthrough]]; - case U'\u00D1': /* LATIN CAPITAL LETTER N WITH TILDE */ - [[fallthrough]]; - case U'\u00D2': /* LATIN CAPITAL LETTER O WITH GRAVE */ - [[fallthrough]]; - case U'\u00D3': /* LATIN CAPITAL LETTER O WITH ACUTE */ - [[fallthrough]]; - case U'\u00D4': /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00D5': /* LATIN CAPITAL LETTER O WITH TILDE */ - [[fallthrough]]; - case U'\u00D6': /* LATIN CAPITAL LETTER O WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00D8': /* LATIN CAPITAL LETTER O WITH STROKE */ - [[fallthrough]]; - case U'\u00D9': /* LATIN CAPITAL LETTER U WITH GRAVE */ - [[fallthrough]]; - case U'\u00DA': /* LATIN CAPITAL LETTER U WITH STROKE */ - [[fallthrough]]; - case U'\u00DB': /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u00DC': /* LATIN CAPITAL LETTER U WITH DIAERESIS */ - [[fallthrough]]; - case U'\u00DD': /* LATIN CAPITAL LETTER Y WITH ACUTE */ - [[fallthrough]]; - case U'\u00DE': /* LATIN CAPITAL LETTER THORN */ - [[fallthrough]]; - case U'\u0100': /* LATIN CAPITAL LETTER A WITH MACRON */ - [[fallthrough]]; - case U'\u0102': /* LATIN CAPITAL LETTER A WITH BREVE */ - [[fallthrough]]; - case U'\u0104': /* LATIN CAPITAL LETTER A WITH OGONEK */ - [[fallthrough]]; - case U'\u0106': /* LATIN CAPITAL LETTER C WITH ACUTE */ - [[fallthrough]]; - case U'\u0108': /* LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u010A': /* LATIN CAPITAL LETTER C WITH DOT ABOVE */ - [[fallthrough]]; - case U'\u010C': /* LATIN CAPITAL LETTER C WITH CARON */ - [[fallthrough]]; - case U'\u010E': /* LATIN CAPITAL LETTER D WITH CARON */ - [[fallthrough]]; - case U'\u0110': /* LATIN CAPITAL LETTER D WITH STROKE */ - [[fallthrough]]; - case U'\u0112': /* LATIN CAPITAL LETTER E WITH MACRON */ - [[fallthrough]]; - case U'\u0114': /* LATIN CAPITAL LETTER E WITH BREVE */ - [[fallthrough]]; - case U'\u0116': /* LATIN CAPITAL LETTER E WITH DOT ABOVE */ - [[fallthrough]]; - case U'\u0118': /* LATIN CAPITAL LETTER E WITH OGONEK */ - [[fallthrough]]; - case U'\u011A': /* LATIN CAPITAL LETTER E WITH CARON */ - [[fallthrough]]; - case U'\u011C': /* LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ - [[fallthrough]]; - case U'\u014A': /* LATIN CAPITAL LETTER ENG */ - [[fallthrough]]; - case U'\u0152': /* LATIN CAPITAL LIGATURE OE */ - [[fallthrough]]; - case U'\u0186': /* LATIN CAPITAL LETTER OPEN O */ - [[fallthrough]]; - case U'\u018E': /* LATIN CAPITAL LETTER REVERSED E */ - [[fallthrough]]; - case U'\u018F': /* LATIN CAPITAL LETTER SCHWA */ - [[fallthrough]]; - case U'\u0190': /* LATIN CAPITAL LETTER OPEN E */ - [[fallthrough]]; - case U'\u0194': /* LATIN CAPITAL LETTER GAMMA */ - [[fallthrough]]; - case U'\u0196': /* LATIN CAPITAL LETTER IOTA */ - [[fallthrough]]; - case U'\u01A9': /* LATIN CAPITAL LETTER ESH */ - [[fallthrough]]; - case U'\u01B1': /* LATIN CAPITAL LETTER UPSILON */ - [[fallthrough]]; - case U'\u01B2': /* LATIN CAPITAL LETTER V WITH HOOk */ - [[fallthrough]]; - case U'\u01B7': /* LATIN CAPITAL LETTER EZH */ - [[fallthrough]]; - case U'\u01F7': /* LATIN CAPITAL LETTER WYNN */ - [[fallthrough]]; - case U'\u021C': /* LATIN CAPITAL LETTER YOGH */ - [[fallthrough]]; - case U'\u0241': /* LATIN CAPITAL LETTER GLOTTAL STOP */ - [[fallthrough]]; - case U'\u0391': /* GREEK CAPITAL LETTER ALPHA */ - [[fallthrough]]; - case U'\u0392': /* GREEK CAPITAL LETTER BETA */ - [[fallthrough]]; - case U'\u0393': /* GREEK CAPITAL LETTER GAMMA */ - [[fallthrough]]; - case U'\u0394': /* GREEK CAPITAL LETTER DELTA */ - [[fallthrough]]; - case U'\u0395': /* GREEK CAPITAL LETTER EPSILON */ - [[fallthrough]]; - case U'\u0396': /* GREEK CAPITAL LETTER ZETA */ - [[fallthrough]]; - case U'\u0397': /* GREEK CAPITAL LETTER ETA */ - [[fallthrough]]; - case U'\u0398': /* GREEK CAPITAL LETTER THETA */ - [[fallthrough]]; - case U'\u0399': /* GREEK CAPITAL LETTER IOTA */ - [[fallthrough]]; - case U'\u039A': /* GREEK CAPITAL LETTER KAPPA */ - [[fallthrough]]; - case U'\u039B': /* GREEK CAPITAL LETTER LAMBDA */ - [[fallthrough]]; - case U'\u039C': /* GREEK CAPITAL LETTER MU */ - [[fallthrough]]; - case U'\u039D': /* GREEK CAPITAL LETTER NU */ - [[fallthrough]]; - case U'\u039E': /* GREEK CAPITAL LETTER XI */ - [[fallthrough]]; - case U'\u039F': /* GREEK CAPITAL LETTER OMICRON */ - [[fallthrough]]; - case U'\u03A0': /* GREEK CAPITAL LETTER PI */ - [[fallthrough]]; - case U'\u03A1': /* GREEK CAPITAL LETTER RHO */ - [[fallthrough]]; - case U'\u03A3': /* GREEK CAPITAL LETTER SIGMA */ - [[fallthrough]]; - case U'\u03A4': /* GREEK CAPITAL LETTER TAU */ - [[fallthrough]]; - case U'\u03A5': /* GREEK CAPITAL LETTER UPSILON */ - [[fallthrough]]; - case U'\u03A6': /* GREEK CAPITAL LETTER PHI */ - [[fallthrough]]; - case U'\u03A7': /* GREEK CAPITAL LETTER CHI */ - [[fallthrough]]; - case U'\u03A8': /* GREEK CAPITAL LETTER PSI */ - [[fallthrough]]; - case U'\u03A9': /* GREEK CAPITAL LETTER OMEGA */ - [[fallthrough]]; - case U'\u1E9E': /* LATIN CAPITAL LETTER SHARP S */ - [[fallthrough]]; - case U'\u2C6D': /* LATIN CAPITAL LETTER ALPHA */ - [[fallthrough]]; - case U'\uA77D': /* LATIN CAPITAL LETTER INSULAR G */ - [[fallthrough]]; - case U'\uA7B4': /* LATIN CAPITAL LETTER BETA */ - [[fallthrough]]; - case U'\uA7B6': /* LATIN CAPITAL LETTER OMEGA */ - return true; - } -} diff --git a/dux/include/dux/str.d/isxdigit.ii b/dux/include/dux/str.d/isxdigit.ii deleted file mode 100644 index 29a613b..0000000 --- a/dux/include/dux/str.d/isxdigit.ii +++ /dev/null @@ -1,58 +0,0 @@ -/* - 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 isxdigit(char32_t const _chr) noexcept -> bool { - switch (_chr) { - [[likely]] default: - return false; - break; - case U'\u0030': /* DIGIT ZERO */ - [[fallthrough]]; - case U'\u0031': /* DIGIT ONE */ - [[fallthrough]]; - case U'\u0032': /* DIGIT TWO */ - [[fallthrough]]; - case U'\u0033': /* DIGIT THREE */ - [[fallthrough]]; - case U'\u0034': /* DIGIT FOUR */ - [[fallthrough]]; - case U'\u0035': /* DIGIT FIVE */ - [[fallthrough]]; - case U'\u0036': /* DIGIT SIX */ - [[fallthrough]]; - case U'\u0037': /* DIGIT SEVEN */ - [[fallthrough]]; - case U'\u0038': /* DIGIT EIGHT */ - [[fallthrough]]; - case U'\u0039': /* DIGIT NINE */ - [[fallthrough]]; - case U'\u0041': /* LATIN CAPITAL LETTER A */ - [[fallthrough]]; - case U'\u0042': /* LATIN CAPITAL LETTER B */ - [[fallthrough]]; - case U'\u0043': /* LATIN CAPITAL LETTER C */ - [[fallthrough]]; - case U'\u0044': /* LATIN CAPITAL LETTER D */ - [[fallthrough]]; - case U'\u0045': /* LATIN CAPITAL LETTER E */ - [[fallthrough]]; - case U'\u0046': /* LATIN CAPITAL LETTER F */ - return true; - } -} diff --git a/dux/include/dux/str.d/uniblk.ii b/dux/include/dux/str.d/uniblk.ii deleted file mode 100644 index 8df097b..0000000 --- a/dux/include/dux/str.d/uniblk.ii +++ /dev/null @@ -1,487 +0,0 @@ -/* - 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 uniblk(char32_t const _chr) noexcept -> char const * { - if(_chr <= U'\u007F') { - return "BASIC LATIN"; - } - if(_chr >= U'\u0080' && _chr <= U'\u00FF') { - return "LATIN-1 SUPPLEMENT"; - } - if(_chr >= U'\u0100' && _chr <= U'\u017F') { - return "LATIN EXTENDED-A"; - } - if(_chr >= U'\u0180' && _chr <= U'\u024F') { - return "LATIN EXTENDED-B"; - } - if(_chr >= U'\u0250' && _chr <= U'\u02AF') { - return "IPA EXTENSIONS"; - } - if(_chr >= U'\u02B0' && _chr <= U'\u02FF') { - return "SPACING MODIFIER LETTERS"; - } - if(_chr >= U'\u0300' && _chr <= U'\u036F') { - return "COMBINING DIRACITICAL MARKS"; - } - if(_chr >= U'\u0370' && _chr <= U'\u03FF') { - return "GREEK AND COPTIC"; - } - if(_chr >= U'\u0400' && _chr <= U'\u04FF') { - return "CYRILLIC"; - } - if(_chr >= U'\u0500' && _chr <= U'\u052F') { - return "CYRILLIC SUPPLEMENT"; - } - if(_chr >= U'\u0530' && _chr <= U'\u058F') { - return "ARMENIAN"; - } - if(_chr >= U'\u0590' && _chr <= U'\u05FF') { - return "HEBREW"; - } - if(_chr >= U'\u0600' && _chr <= U'\u06FF') { - return "ARABIC"; - } - if(_chr >= U'\u0700' && _chr <= U'\u074F') { - return "SYRIAC"; - } - if(_chr >= U'\u0750' && _chr <= U'\u077F') { - return "ARABIC SUPPLEMENT"; - } - if(_chr >= U'\u0780' && _chr <= U'\u07BF') { - return "THAANA"; - } - if(_chr >= U'\u07C0' && _chr <= U'\u07FF') { - return "NKO"; - } - if(_chr >= U'\u0800' && _chr <= U'\u083F') { - return "SAMARITAN"; - } - if(_chr >= U'\u0840' && _chr <= U'\u085F') { - return "MANDAIC"; - } - if(_chr >= U'\u0860' && _chr <= U'\u086F') { - return "SYRIAC SUPPLEMENT"; - } - if(_chr >= U'\u08A0' && _chr <= U'\u08FF') { - return "ARABIC EXTENDED-A"; - } - if(_chr >= U'\u0900' && _chr <= U'\u097F') { - return "DEVANAGARI"; - } - if(_chr >= U'\u0980' && _chr <= U'\u09FF') { - return "BENGALI"; - } - if(_chr >= U'\u0A00' && _chr <= U'\u0A7F') { - return "GURMUKHI"; - } - if(_chr >= U'\u0A80' && _chr <= U'\u0AFF') { - return "GUJARATI"; - } - if(_chr >= U'\u0B00' && _chr <= U'\u0B7F') { - return "ORIYAS"; - } - if(_chr >= U'\u0B80' && _chr <= U'\u0BFF') { - return "TAMIL"; - } - if(_chr >= U'\u0C00' && _chr <= U'\u0C7F') { - return "TELUG"; - } - if(_chr >= U'\u0C80' && _chr <= U'\u0CFF') { - return "KANNADA"; - } - if(_chr >= U'\u0D00' && _chr <= U'\u0D7F') { - return "MALAYALAM"; - } - if(_chr >= U'\u0D80' && _chr <= U'\u0DFF') { - return "SINHALA"; - } - if(_chr >= U'\u0E00' && _chr <= U'\u0E7F') { - return "THAI"; - } - if(_chr >= U'\u0E80' && _chr <= U'\u0EFF') { - return "LAO"; - } - if(_chr >= U'\u0F00' && _chr <= U'\u0FFF') { - return "TIBETAN"; - } - if(_chr >= U'\u1000' && _chr <= U'\u109F') { - return "MYANMAR"; - } - if(_chr >= U'\u10A0' && _chr <= U'\u10FF') { - return "GEORGIAN"; - } - if(_chr >= U'\u1100' && _chr <= U'\u11FF') { - return "HANGUL JAMO"; - } - if(_chr >= U'\u1200' && _chr <= U'\u137F') { - return "ETHIOPIC"; - } - if(_chr >= U'\u1380' && _chr <= U'\u139F') { - return "ETHIOPIC SUPPLEMENT"; - } - if(_chr >= U'\u13A0' && _chr <= U'\u13FF') { - return "CHEROKEE"; - } - if(_chr >= U'\u1400' && _chr <= U'\u167F') { - return "UNIFIED CANADIAN ABORIGINAL SYLLABICS"; - } - if(_chr >= U'\u1680' && _chr <= U'\u169F') { - return "OGHAM"; - } - if(_chr >= U'\u16A0' && _chr <= U'\u16FF') { - return "RUNIC"; - } - if(_chr >= U'\u1700' && _chr <= U'\u171F') { - return "TAGALOG"; - } - if(_chr >= U'\u1720' && _chr <= U'\u173F') { - return "HANUNOO"; - } - if(_chr >= U'\u1740' && _chr <= U'\u175F') { - return "BUHID"; - } - if(_chr >= U'\u1760' && _chr <= U'\u177F') { - return "TAGBANWA"; - } - if(_chr >= U'\u1700' && _chr <= U'\u17FF') { - return "TAGALOG"; - } - if(_chr >= U'\u1780' && _chr <= U'\u171F') { - return "KHMER"; - } - if(_chr >= U'\u1800' && _chr <= U'\u18AF') { - return "MONGOLIAN"; - } - if(_chr >= U'\u18B0' && _chr <= U'\u18FF') { - return "UNIFIED CANADIAN ABORIGINAL SYLLABICS EXTENDED"; - } - if(_chr >= U'\u1900' && _chr <= U'\u194F') { - return "LIMB"; - } - if(_chr >= U'\u1950' && _chr <= U'\u197F') { - return "TAI LE"; - } - if(_chr >= U'\u1980' && _chr <= U'\u19DF') { - return "::new TAI LUE"; - } - if(_chr >= U'\u19E0' && _chr <= U'\u19FF') { - return "KHMER SYMBOLS"; - } - if(_chr >= U'\u1A00' && _chr <= U'\u1A1F') { - return "BUGINESE"; - } - if(_chr >= U'\u1A20' && _chr <= U'\u1AAF') { - return "TAI THAM"; - } - if(_chr >= U'\u1AB0' && _chr <= U'\u1AFF') { - return "COMBINING DIACRITICAL MARKS EXTENDED"; - } - if(_chr >= U'\u1B00' && _chr <= U'\u1B7F') { - return "BALINESE"; - } - if(_chr >= U'\u1B80' && _chr <= U'\u1BBF') { - return "SUNDANESE"; - } - if(_chr >= U'\u1BC0' && _chr <= U'\u1BFF') { - return "BATAK"; - } - if(_chr >= U'\u1C00' && _chr <= U'\u1C4F') { - return "LEPCHA"; - } - if(_chr >= U'\u1C50' && _chr <= U'\u1C7F') { - return "OL CHIKI"; - } - if(_chr >= U'\u1C80' && _chr <= U'\u1C8F') { - return "CYRILLIC EXTENDED C"; - } - if(_chr >= U'\u1C90' && _chr <= U'\u1CBF') { - return "GEORGIAN EXTENDED"; - } - if(_chr >= U'\u1CC0' && _chr <= U'\u1CCF') { - return "SUNDANESE SUPPLEMENT"; - } - if(_chr >= U'\u1CD0' && _chr <= U'\u1CFF') { - return "VEDIC EXTENSIONS"; - } - if(_chr >= U'\u1D00' && _chr <= U'\u1D7F') { - return "PHONETIC EXTENSIONS"; - } - if(_chr >= U'\u1D80' && _chr <= U'\u1DBF') { - return "PHONETIC EXTENSIONS SUPPLEMENT"; - } - if(_chr >= U'\u1DC0' && _chr <= U'\u1DFF') { - return "COMBINING DIACRITICAL MARKS SUPPLEMENT"; - } - if(_chr >= U'\u1E00' && _chr <= U'\u1EFF') { - return "LATIN EXTENDED ADDITIONAL"; - } - if(_chr >= U'\u1F00' && _chr <= U'\u1FFF') { - return "GREEK EXTENDED"; - } - if(_chr >= U'\u2000' && _chr <= U'\u206F') { - return "GENERAL PUNCTUATION"; - } - if(_chr >= U'\u2070' && _chr <= U'\u209F') { - return "SUPERSCRIPTS AND SUBSCRIPTS"; - } - if(_chr >= U'\u20A0' && _chr <= U'\u20CF') { - return "CURRENCY SYMBOLS"; - } - if(_chr >= U'\u20D0' && _chr <= U'\u20FF') { - return "COMBINING DIACRITICAL MARKS FOR SYMBOLS"; - } - if(_chr >= U'\u2100' && _chr <= U'\u214F') { - return "LETTERLIKE SYMBOLS"; - } - if(_chr >= U'\u2150' && _chr <= U'\u218F') { - return "NUMBER FORMS"; - } - if(_chr >= U'\u2190' && _chr <= U'\u21FF') { - return "ARROWS"; - } - if(_chr >= U'\U00011A00' && _chr <= U'\U00011A4F') { - return "ZANABAZAR SQUARE"; - } - if(_chr >= U'\U00011A50' && _chr <= U'\U00011AAF') { - return "SOYOMBO"; - } - if(_chr >= U'\U00011AC0' && _chr <= U'\U00011AFF') { - return "PAU CIN HA"; - } - if(_chr >= U'\U00011C00' && _chr <= U'\U00011C6F') { - return "BHAIKSUKI"; - } - if(_chr >= U'\U00011C70' && _chr <= U'\U00011CBF') { - return "MARCHEN"; - } - if(_chr >= U'\U00011D00' && _chr <= U'\U00011D5F') { - return "MASARAM GONDI"; - } - if(_chr >= U'\U00011D60' && _chr <= U'\U00011DAF') { - return "GUNJALA GONDI"; - } - if(_chr >= U'\U00011EE0' && _chr <= U'\U00011EFF') { - return "MAKASAR"; - } - if(_chr >= U'\U00011FB0' && _chr <= U'\U00011FBF') { - return "LISU SUPPLEMENT"; - } - if(_chr >= U'\U00011FC0' && _chr <= U'\U00011FFF') { - return "TAMIL SUPPLEMENT"; - } - if(_chr >= U'\U00012000' && _chr <= U'\U000123FF') { - return "CUNEIFORM"; - } - if(_chr >= U'\U00012400' && _chr <= U'\U0001247F') { - return "CUNEIFORM NUMBERS AND PUNCTUATION"; - } - if(_chr >= U'\U00012480' && _chr <= U'\U0001254F') { - return "EARLY DYNASTIC CUNEIFORM"; - } - if(_chr >= U'\U00013000' && _chr <= U'\U0001342F') { - return "EGYPTIAN HIEROGLYPHS"; - } - if(_chr >= U'\U00013430' && _chr <= U'\U0001343F') { - return "EGYPTIAN HIEROGLYPH FORMAT CONTROLS"; - } - if(_chr >= U'\U00014400' && _chr <= U'\U0001467F') { - return "ANATOLIAN HIEROGLYPHS"; - } - if(_chr >= U'\U00016800' && _chr <= U'\U00016A3F') { - return "BAMUM SUPPLEMENT"; - } - if(_chr >= U'\U00016A40' && _chr <= U'\U00016A6F') { - return "MRO"; - } - if(_chr >= U'\U00016AD0' && _chr <= U'\U00016AFF') { - return "BASSA VAH"; - } - if(_chr >= U'\U00016B00' && _chr <= U'\U00016B8F') { - return "PAHAWH HMONG"; - } - if(_chr >= U'\U00016E40' && _chr <= U'\U00016E9F') { - return "MEDEFAIDRIN"; - } - if(_chr >= U'\U00016F00' && _chr <= U'\U00016F9F') { - return "MIAO"; - } - if(_chr >= U'\U00016FE0' && _chr <= U'\U00016FFF') { - return "IDEOGRAPHIC SYMBOLS AND PUNCTUATION"; - } - if(_chr >= U'\U00017000' && _chr <= U'\U000187FF') { - return "TANGUT"; - } - if(_chr >= U'\U00018800' && _chr <= U'\U00018AFF') { - return "TANGUT COMPONENTS"; - } - if(_chr >= U'\U00018B00' && _chr <= U'\U00018CFF') { - return "KHITAN SMALL SCRIPT"; - } - if(_chr >= U'\U00018D00' && _chr <= U'\U00018D8F') { - return "TANGUT SUPPLEMENT"; - } - if(_chr >= U'\U0001B000' && _chr <= U'\U0001B0FF') { - return "KANA SUPPLEMENT"; - } - if(_chr >= U'\U0001B100' && _chr <= U'\U0001B12F') { - return "KANA EXTENDED-A"; - } - if(_chr >= U'\U0001B130' && _chr <= U'\U0001B16F') { - return "SMALL KANA EXTENSION"; - } - if(_chr >= U'\U0001B170' && _chr <= U'\U0001B2FF') { - return "NUSH"; - } - if(_chr >= U'\U0001BC00' && _chr <= U'\U0001BC9F') { - return "DUPLOYAN"; - } - if(_chr >= U'\U0001BCA0' && _chr <= U'\U0001BCAF') { - return "SHORTHAND FORMAT CONTROLS"; - } - if(_chr >= U'\U0001D000' && _chr <= U'\U0001D0FF') { - return "BYZANTINE MUSICAL SYMBOLS"; - } - if(_chr >= U'\U0001D100' && _chr <= U'\U0001D1FF') { - return "MUSICAL SYMBOLS"; - } - if(_chr >= U'\U0001D200' && _chr <= U'\U0001D24F') { - return "ANCIENT GREEK MUSICAL NOTATION"; - } - if(_chr >= U'\U0001D2E0' && _chr <= U'\U0001D2FF') { - return "MAYAN NUMERALS"; - } - if(_chr >= U'\U0001D300' && _chr <= U'\U0001D35F') { - return "TAI XUAN JING SYMBOLS"; - } - if(_chr >= U'\U0001D360' && _chr <= U'\U0001D37F') { - return "COUNTING ROD NUMERALS"; - } - if(_chr >= U'\U0001D400' && _chr <= U'\U0001D7FF') { - return "MATHEMATICAL ALPHANUMERIC SYMBOLS"; - } - if(_chr >= U'\U0001D800' && _chr <= U'\U0001DAAF') { - return "SUTTON SIGNWRITING"; - } - if(_chr >= U'\U0001E000' && _chr <= U'\U0001E02F') { - return "GLAGOLITIC SUPPLEMENT"; - } - if(_chr >= U'\U0001E100' && _chr <= U'\U0001E14F') { - return "NYIAKENG PUACHUE HMONG"; - } - if(_chr >= U'\U0001E2C0' && _chr <= U'\U0001E2FF') { - return "WANCHO"; - } - if(_chr >= U'\U0001E800' && _chr <= U'\U0001E8DF') { - return "MENDE KIKAKUI"; - } - if(_chr >= U'\U0001E900' && _chr <= U'\U0001E95F') { - return "ADLAM"; - } - if(_chr >= U'\U0001EC70' && _chr <= U'\U0001ECBF') { - return "INDIC SIYAQ NUMBERS"; - } - if(_chr >= U'\U0001ED00' && _chr <= U'\U0001ED4F') { - return "OTTOMAN SIYAQ NUMBERS"; - } - if(_chr >= U'\U0001EE00' && _chr <= U'\U0001EEFF') { - return "ARABIC MATHEMATICAL ALPHABETIC SYMBOLS"; - } - if(_chr >= U'\U0001F000' && _chr <= U'\U0001F02F') { - return "MAHJONG TILES"; - } - if(_chr >= U'\U0001F030' && _chr <= U'\U0001F09F') { - return "DOMINO TILES"; - } - if(_chr >= U'\U0001F0A0' && _chr <= U'\U0001F0FF') { - return "PLAYING CARDS"; - } - if(_chr >= U'\U0001F100' && _chr <= U'\U0001F1FF') { - return "ENCLOSED ALPHANUMERIC SUPPLEMENT"; - } - if(_chr >= U'\U0001F200' && _chr <= U'\U0001F2FF') { - return "ENCLOSED IDEOGRAPHIC SUPPLEMENT"; - } - if(_chr >= U'\U0001F300' && _chr <= U'\U0001F5FF') { - return "MISCELLANEOUS SYMBOLS AND PICTOGRAPHS"; - } - if(_chr >= U'\U0001F600' && _chr <= U'\U0001F64F') { - return "EMOTICONS"; - } - if(_chr >= U'\U0001F650' && _chr <= U'\U0001F67F') { - return "ORNAMENTAL DINGBATS"; - } - if(_chr >= U'\U0001F680' && _chr <= U'\U0001F6FF') { - return "TRANSPORT AND MAP SYMBOLS"; - } - if(_chr >= U'\U0001F700' && _chr <= U'\U0001F77F') { - return "ALCHEMICAL SYMBOLS"; - } - if(_chr >= U'\U0001F780' && _chr <= U'\U0001F7FF') { - return "GEOMETRIC SHAPES EXTENDED"; - } - if(_chr >= U'\U0001F800' && _chr <= U'\U0001F8FF') { - return "SUPPLEMENTAL ARROWS-C"; - } - if(_chr >= U'\U0001F900' && _chr <= U'\U0001F9FF') { - return "SUPPLEMENTAL SYMBOLS AND PICTOGRAPHS"; - } - if(_chr >= U'\U0001FA00' && _chr <= U'\U0001FA6F') { - return "CHESS SYMBOLS"; - } - if(_chr >= U'\U0001FA70' && _chr <= U'\U0001FAFF') { - return "SYMBOLS AND PICTOGRAPHS EXTENDED-A"; - } - if(_chr >= U'\U0001FB00' && _chr <= U'\U0001FBFF') { - return "SYMBOLS FOR LEGACY COMPUTING"; - } - if(_chr >= U'\U00020000' && _chr <= U'\U0002A6DF') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION B"; - } - if(_chr >= U'\U0002A700' && _chr <= U'\U0002B73F') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION C"; - } - if(_chr >= U'\U0002B740' && _chr <= U'\U0002B81F') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION D"; - } - if(_chr >= U'\U0002B820' && _chr <= U'\U0002CEAF') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION E"; - } - if(_chr >= U'\U0002CEB0' && _chr <= U'\U0002EBEF') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION F"; - } - if(_chr >= U'\U0002F800' && _chr <= U'\U0002FA1F') { - return "CJK COMPATIBILITY IDEOGRAPHS SUPPLEMENT"; - } - if(_chr >= U'\U00030000' && _chr <= U'\U0003134F') { - return "CJK UNIFIED IDEOGRAPHS EXTENSION G"; - } - if(_chr >= U'\U000E0000' && _chr <= U'\U000E007F') { - return "TAGS"; - } - if(_chr >= U'\U000E0100' && _chr <= U'\U000E1EFF') { - return "VARIATION SELECTORS SUPPLEMENT"; - } - if(_chr >= U'\U000F0000' && _chr <= U'\U000FFFFF') { - return "SUPPLEMENTARY PRIVATE USE AREA-A"; - } - if(_chr >= U'\U00100000' && _chr <= U'\U0010FFFF') { - return "SUPPLEMENTARY PRIVATE USE AREA-B"; - } - return "UNDEFINED IN UNICODE"; -} diff --git a/dux/include/dux/str.d/uninm.ii b/dux/include/dux/str.d/uninm.ii deleted file mode 100644 index 6acaec5..0000000 --- a/dux/include/dux/str.d/uninm.ii +++ /dev/null @@ -1,2717 +0,0 @@ -/* - 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 deleted file mode 100644 index 86f5c17..0000000 --- a/dux/include/dux/str.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - 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 deleted file mode 100644 index eb0840b..0000000 --- a/dux/include/dux/sysinfo.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - 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/dux/include/dux/thr.h b/dux/include/dux/thr.h new file mode 100644 index 0000000..e86f030 --- /dev/null +++ b/dux/include/dux/thr.h @@ -0,0 +1,30 @@ +/* + Copyright 2019-2023 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 Lesser 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>. +*/ + +#if !defined(dux_hdr_thr) +#define dux_hdr_thr + +#include <dux/dux.h> + +dux_prv_cdec + +struct dux_prv_thr; +typedef struct dux_prv_thr dux_thr; + +zp_noret dux_err dux_exi(void * res); + +dux_err dux_slp(zp_f04 sec); + +dux_err dux_crtthr(dux_thr * * thr); +dux_err dux_srtthr(dux_thr * thr,void * (* srt)(dux_thr *,void *),void *); +dux_err dux_joithr(dux_thr * thr,void * * res); + +dux_prv_cdecend + +#endif diff --git a/dux/include/dux/thrd b/dux/include/dux/thrd deleted file mode 100644 index 52436c4..0000000 --- a/dux/include/dux/thrd +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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/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 deleted file mode 100644 index 86f5c17..0000000 --- a/dux/include/dux/thrd.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - 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 deleted file mode 100644 index dabb7a3..0000000 --- a/dux/include/dux/time +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 deleted file mode 100644 index 209d213..0000000 --- a/dux/include/dux/time.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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/source/dux/errmsg.c b/dux/source/dux/errmsg.c new file mode 100644 index 0000000..9b4fe99 --- /dev/null +++ b/dux/source/dux/errmsg.c @@ -0,0 +1,44 @@ +/* + Copyright 2019-2023 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 Lesser 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with dux. If not, see <https://www.gnu.org/licenses>. +*/ + +#include <dux/prv/dux.h> + +char const * dux_errmsg(dux_err const err) { + switch (err) { + case dux_err_oky: + return "okay"; + case dux_err_err: + return "error"; + case dux_err_badalc: + return "bad memory allocation"; + case dux_err_badfil: + return "bad file"; + case dux_err_badfmt: + return "bad format specifier"; + case dux_err_badprm: + return "bad permissions"; + case dux_err_badval: + return "bad value"; + case dux_err_eof: + return "end of file"; + case dux_err_exs: + return "file already exists"; + case dux_err_isdir: + return "is directory"; + case dux_err_nodir: + return "no such directory"; + case dux_err_nofil: + return "no such file or directory"; + case dux_err_redonl: + return "file is read only"; + case dux_err_spclim: + return "space limit reached"; + } + zp_unrch(); +} diff --git a/dux/src/abrt.cc b/dux/src/abrt.cc deleted file mode 100644 index ef0fbf5..0000000 --- a/dux/src/abrt.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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; - while (lock.test_and_set()) {} /* We make sure we don't abort from multiple threads. */ - ::dux::dbglog("dux.abrt :: Abort\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 deleted file mode 100644 index 278b095..0000000 --- a/dux/src/alloc.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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/crtfile.cc b/dux/src/crtfile.cc deleted file mode 100644 index 2d1d48b..0000000 --- a/dux/src/crtfile.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - 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/io> - -# include <dux/str> - -# include <fcntl.h> -# if defined(dux_os_freebsd) -# include <errno.h> -# elif defined(dux_os_linux) -# include <linux/errno.h> -# endif - -auto ::dux::crtfile(char const * _path,::dux::uint16 const _acs) noexcept -> ::dux::file { - dux_ass("",_path != nullptr); - ::dux::file file; - ::dux::dbglog("dux.crtfile :: Create \"%s\"\n",_path); - auto const sysdat {static_cast<::dux::priv::filesysdat *>(file._sysdat)}; -# if defined(dux_os_posix) -open:; - auto const openatret {::dux_priv_posix_openat(AT_FDCWD,_path,O_CREAT | O_TRUNC | O_WRONLY,static_cast<::mode_t>(_acs))}; - if (openatret == -0x1) [[unlikely]] { - switch (dux_priv_errno) { - default: - ::dux::seterr(::dux::errcd::runerr); - break; - case EACCES: - [[fallthrough]]; - case EROFS: - ::dux::seterr(::dux::errcd::badacs); - break; - case EINTR: - goto open; - case ENOTDIR: - ::dux::seterr(::dux::errcd::nodir); - break; - } - ::dux::dbglog("dux.\x1B[91mcrtfile\x1B[0m :: Error!\n"); - return file; - } - sysdat->fd = openatret; -# endif - file._path.ptr = _path; - file._path.sz = ::dux::strlen(_path); - file._typ = ::dux::iotyp::w; - file._isopen = true; - return file; -} diff --git a/dux/src/errcdnm.cc b/dux/src/errcdnm.cc deleted file mode 100644 index 8401c28..0000000 --- a/dux/src/errcdnm.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - 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 deleted file mode 100644 index e1eb4f8..0000000 --- a/dux/src/exit.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* - 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/thrd> - -# 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 (::dux::ismainthrd()) [[unlikely]] { /* Check if the calling thread is also the main thread. Only thread exit and quick exit may be invoked outside the main thread. */ - ::dux::dbglog("dux.\x1B[91mexit\x1B[0m :: Standard exit invoked outside main thread!\n"); - ::dux::abrt(); - } - ::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/dux/src/file.cc b/dux/src/file.cc deleted file mode 100644 index 094b310..0000000 --- a/dux/src/file.cc +++ /dev/null @@ -1,197 +0,0 @@ -/* - 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/io> - -# include <dux/str> - -# include <fcntl.h> -# if defined(dux_os_freebsd) -# include <errno.h> -# elif defined(dux_os_linux) -# include <linux/errno.h> -# endif - -namespace dux::local { - [[nodiscard]] constexpr static auto iotypstr(::dux::iotyp const _typ) noexcept -> ::dux::str { - switch (_typ) { - case ::dux::iotyp::r: - return ::dux::priv::strlittoduxstr("R"); - case ::dux::iotyp::rw: - return ::dux::priv::strlittoduxstr("R/W"); - case ::dux::iotyp::w: - return ::dux::priv::strlittoduxstr("W"); - } - ::dux::unreach(); - } -} - -::dux::file::file() noexcept : _isopen(false) {this->_sysdat = ::dux::alloc<::dux::priv::filesysdat>();} - -::dux::file::~file() noexcept { - if (this->isopen()) [[unlikely]] { - ::dux::dbglog("dux.\x1B[91mfile\x1B[0m :: Pipe wasn't closed!\n"); - ::dux::abrt(); - } - auto const sysdat {static_cast<::dux::priv::filesysdat *>(this->_sysdat)}; - ::dux::free(sysdat); -} - -auto ::dux::file::close() noexcept -> void { - if (!this->isopen()) [[unlikely]] {return;} - ::dux::dbglog("dux.file.close :: Close \"%s\"\n",this->path().ptr); - auto const sysdat {static_cast<::dux::priv::filesysdat *>(this->_sysdat)}; -# if defined(dux_os_posix) -close:; - auto const closeret {::dux_priv_posix_close(sysdat->fd)}; - if (closeret == -0x1) [[unlikely]] { - switch (dux_priv_errno) { - default: - ::dux::seterr(::dux::errcd::runerr); - break; - case EINTR: - goto close; - } - ::dux::dbglog("dux.file.open :: Error!\n"); - return; - } -# endif - this->_isopen = false; -} - -auto ::dux::file::isopen() noexcept -> bool {return this->_isopen;} - -# if false /* Base for dux.pipe.mv (for future implementation): */ -auto ::dux::file::mv(char const * const _newpath) noexcept -> ::dux::str { - auto const oldpath {this->path()}; - auto const newpath {[&_newpath] { - ::dux::str newpath; - newpath.ptr = _newpath; - newpath.sz = ::dux::strlen(_newpath); - return newpath; - }()}; - if (newpath.sz != oldpath.sz || !::dux::memeq(newpath.ptr,newpath.sz,oldpath.ptr)) [[unlikely]] {goto retold;} -retold:; - return oldpath; -} -# endif - -auto ::dux::file::open(char const * const _path,::dux::iotyp const _typ) noexcept -> void { - dux_ass("",_path != nullptr); - if (this->isopen()) [[unlikely]] {this->close();} - ::dux::dbglog("dux.file.open :: Open %s:\"%s\"\n",::dux::local::iotypstr(_typ).ptr,_path); - auto const sysdat {static_cast<::dux::priv::filesysdat *>(this->_sysdat)}; -# if defined(dux_os_posix) - auto const openatflags {[&_typ] { - switch (_typ) { - case ::dux::iotyp::r: - return O_RDONLY; - case ::dux::iotyp::rw: - return O_RDWR; - case ::dux::iotyp::w: - return O_WRONLY; - } - ::dux::unreach(); - }()}; -open:; - auto const openatret {::dux_priv_posix_openat(AT_FDCWD,_path,openatflags,static_cast<::mode_t>(0x0))}; - if (openatret == -0x1) [[unlikely]] { - switch (dux_priv_errno) { - default: - ::dux::seterr(::dux::errcd::runerr); - break; - case EACCES: - [[fallthrough]]; - case EROFS: - ::dux::seterr(::dux::errcd::badacs); - break; - case EINTR: - goto open; - case ENOENT: - ::dux::seterr(::dux::errcd::nofile); - break; - case ENOTDIR: - ::dux::seterr(::dux::errcd::nodir); - break; - } - ::dux::dbglog("dux.file.\x1B[91mopen\x1B[0m :: Error!\n"); - return; - } - sysdat->fd = openatret; -# endif - this->_path.ptr = _path; - this->_path.sz = ::dux::strlen(_path); - this->_typ = _typ; - this->_isopen = true; -} - -auto ::dux::file::path() const noexcept -> ::dux::str {return this->_path;} - -auto ::dux::file::read(::dux::uwrd const _num) noexcept -> ::dux::arr<::dux::uint8> { - if (!this->isopen()) [[unlikely]] { - ::dux::dbglog("dux.file.\x1B[91mread\x1B[0m :: Pipe not open!\n"); - ::dux::abrt(); - } - if (this->typ() != ::dux::iotyp::r && this->typ() != ::dux::iotyp::rw) [[unlikely]] { - ::dux::dbglog("dux.file.\x1B[91mread\x1B[0m :: I/O type (%s) does not support reading!\n",::dux::local::iotypstr(_typ).ptr); - ::dux::abrt(); - } - ::dux::dbglog("dux.file.read :: Read %zu @ \"%s\"\n",_num,this->path()); - auto const sysdat {static_cast<::dux::priv::filesysdat *>(this->_sysdat)}; - ::dux::arr<::dux::uint8> buf; - buf.alloc(_num); -# if defined(dux_os_posix) -read:; - auto const readret {::dux_priv_posix_read(sysdat->fd,buf.raw(),_num)}; - if (readret == dux_swrdl(-0x1)) [[unlikely]] { - switch (dux_priv_errno) { - case EINTR: - goto read; - } - ::dux::dbglog("dux.file.\x1B[91mread\x1B[0m :: Unable to read file!\n"); - ::dux::seterr(::dux::errcd::ioerr); - buf.free(); - return buf; - } -# endif - return buf; -} - -auto ::dux::file::typ() const noexcept -> ::dux::iotyp {return this->_typ;} - -auto ::dux::file::write(void const * const _buf,::dux::uwrd const _sz) noexcept -> void { - dux_ass("",_buf != nullptr); - dux_ass("",_sz != dux_uwrdl(0x0)); - if (!this->isopen()) [[unlikely]] { - ::dux::dbglog("dux.file.\x1B[91mwrite\x1B[0m :: Pipe not open!\n"); - ::dux::abrt(); - } - if (this->typ() != ::dux::iotyp::rw && this->typ() != ::dux::iotyp::w) [[unlikely]] { - ::dux::dbglog("dux.file.\x1B[91mwrite\x1B[0m :: I/O type (%s) does not support writting!\n",::dux::local::iotypstr(_typ)); - ::dux::abrt(); - } - auto const sysdat {static_cast<::dux::priv::filesysdat *>(this->_sysdat)}; - ::dux::dbglog("dux.file.write :: Write %zu @ %p -> \"%s\"\n",_sz,_buf,this->path().ptr); -# if defined(dux_os_posix) - ::dux_priv_posix_write(sysdat->fd,_buf,_sz); - ::dux_priv_posix_fsync(sysdat->fd); -# endif -} diff --git a/dux/src/fndchr.cc b/dux/src/fndchr.cc deleted file mode 100644 index ec06041..0000000 --- a/dux/src/fndchr.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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_fndchr(char const * const restrict _str,int const _chr) -> ::dux_priv_uwrd { - if constexpr (::dux::dbg) { - 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 deleted file mode 100644 index 4ec9864..0000000 --- a/dux/src/free.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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/dux/src/freernd.cc b/dux/src/freernd.cc deleted file mode 100644 index 5325fb1..0000000 --- a/dux/src/freernd.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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/math> - -# include <dux/mem> - -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 deleted file mode 100644 index db7de87..0000000 --- a/dux/src/getallocsz.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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 deleted file mode 100644 index 5bb2ad4..0000000 --- a/dux/src/getenv.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 deleted file mode 100644 index e25311f..0000000 --- a/dux/src/getmainparam.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - 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 deleted file mode 100644 index e1c2532..0000000 --- a/dux/src/getnummainparams.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - 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 deleted file mode 100644 index 75b7d4b..0000000 --- a/dux/src/gettime.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - 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,×pec); - 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/ismainthrd.cc b/dux/src/ismainthrd.cc deleted file mode 100644 index c5f2cf8..0000000 --- a/dux/src/ismainthrd.cc +++ /dev/null @@ -1,33 +0,0 @@ -/* - 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/thrd> - -auto ::dux::ismainthrd() noexcept -> bool { -# if defined(dux_os_linux) - if (::dux_priv_posix_getpid() != static_cast<::pid_t>(::dux::syscall(__NR_gettid))) {return true;} /* Check if calling thread is also the main thread. Only thread exit and quick exit are allowed outside the main thread. */ -# endif - return false; /* I don't know how to check for this on other platforms. */ -} - -# pragma GCC diagnostic ignored "-Wmissing-declarations" - -extern "C" auto dux_ismainthrd() -> bool {return ::dux::ismainthrd();} diff --git a/dux/src/mainparams.cc b/dux/src/mainparams.cc deleted file mode 100644 index e00e62e..0000000 --- a/dux/src/mainparams.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - 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/memeq.cc b/dux/src/memeq.cc deleted file mode 100644 index bcf3e88..0000000 --- a/dux/src/memeq.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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::memeq(void const * const restrict _lptr,::dux::uwrd const _num,void const * const restrict _rptr) noexcept -> bool { - auto lptr {static_cast<::dux::uint8 const *>(_lptr)}; - auto rptr {static_cast<::dux::uint8 const *>(_rptr)}; - auto const maxlptr {lptr + _num - dux_uwrdl(0x1)}; - for (;lptr <= maxlptr;++lptr,++rptr) {if (*lptr != *rptr) [[unlikely]] {return false;}} - return true; -} - -# pragma GCC diagnostic ignored "-Wmissing-declarations" - -extern "C" auto dux_memeq(void const * const restrict _lptr,::dux::uwrd const _num,void const * const restrict _rptr) noexcept -> bool {return ::dux::memeq(_lptr,_num,_rptr);} diff --git a/dux/src/onexit.cc b/dux/src/onexit.cc deleted file mode 100644 index cde37f2..0000000 --- a/dux/src/onexit.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 :: Register %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) -> void {::dux::onexit(_fn);} diff --git a/dux/src/priv/alloc.cc b/dux/src/priv/alloc.cc deleted file mode 100644 index 26dfa96..0000000 --- a/dux/src/priv/alloc.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - 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 deleted file mode 100644 index f0ba07d..0000000 --- a/dux/src/priv/assfail.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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 deleted file mode 100644 index 490d101..0000000 --- a/dux/src/priv/cpy.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/dux/src/priv/curerrcd.c b/dux/src/priv/curerrcd.c deleted file mode 100644 index b046e5c..0000000 --- a/dux/src/priv/curerrcd.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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> - -_Thread_local enum dux_priv_errcd dux_priv_curerrcd; diff --git a/dux/src/priv/dbglog.c b/dux/src/priv/dbglog.c deleted file mode 100644 index 7d88d72..0000000 --- a/dux/src/priv/dbglog.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 <stdarg.h> -# include <stdio.h> - -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/dux/src/priv/dbgunreach.c b/dux/src/priv/dbgunreach.c deleted file mode 100644 index f2f80a2..0000000 --- a/dux/src/priv/dbgunreach.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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_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 deleted file mode 100644 index 25ec3f0..0000000 --- a/dux/src/priv/dup.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - 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 deleted file mode 100644 index 2495ca1..0000000 --- a/dux/src/priv/fill.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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/dux/src/priv/free.cc b/dux/src/priv/free.cc deleted file mode 100644 index 93e04b5..0000000 --- a/dux/src/priv/free.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 <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 deleted file mode 100644 index a94bf48..0000000 --- a/dux/src/priv/geterrnoptr.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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 deleted file mode 100644 index 2263dff..0000000 --- a/dux/src/priv/logstderr.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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/dux/src/priv/nomedia.c b/dux/src/priv/nomedia.c deleted file mode 100644 index 26e19bf..0000000 --- a/dux/src/priv/nomedia.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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> - -bool const dux_priv_nomedia = -# if defined(dux_priv_dis_media) - true; -# else - false; -# endif diff --git a/dux/src/priv/plot.c b/dux/src/priv/plot.c deleted file mode 100644 index 36f38a9..0000000 --- a/dux/src/priv/plot.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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_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; - } - 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 deleted file mode 100644 index 6210c5c..0000000 --- a/dux/src/priv/posix/clock_gettime.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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/dux/src/priv/posix/close.c b/dux/src/priv/posix/close.c deleted file mode 100644 index 68dd2d1..0000000 --- a/dux/src/priv/posix/close.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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_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/fsync.c b/dux/src/priv/posix/fsync.c deleted file mode 100644 index f5a2840..0000000 --- a/dux/src/priv/posix/fsync.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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_fsync(int const fd) { -# if defined(dux_os_freebsd) - return (int)dux_syscall(SYS_fsync,fd); -# elif defined(dux_os_linux) - return (int)dux_syscall(__NR_fsync,fd); -# endif -} diff --git a/dux/src/priv/posix/getpid.c b/dux/src/priv/posix/getpid.c deleted file mode 100644 index c7fa17d..0000000 --- a/dux/src/priv/posix/getpid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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/dux/src/priv/posix/getrandom.c b/dux/src/priv/posix/getrandom.c deleted file mode 100644 index ccedaaf..0000000 --- a/dux/src/priv/posix/getrandom.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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_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/dux/src/priv/posix/kill.c b/dux/src/priv/posix/kill.c deleted file mode 100644 index be1534b..0000000 --- a/dux/src/priv/posix/kill.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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 - -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 deleted file mode 100644 index 7361653..0000000 --- a/dux/src/priv/posix/mmap.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 deleted file mode 100644 index 14cb940..0000000 --- a/dux/src/priv/posix/nanosleep.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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 deleted file mode 100644 index 1069c1e..0000000 --- a/dux/src/priv/posix/openat.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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 <fcntl.h> -# 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,mode_t const mode) { -# if defined(dux_os_freebsd) - return (int)dux_syscall(SYS_open,fd,pathname,flags,mode); -# elif defined(dux_os_linux) - return (int)dux_syscall(__NR_openat,fd,pathname,flags,mode); -# endif -} diff --git a/dux/src/priv/posix/read.c b/dux/src/priv/posix/read.c deleted file mode 100644 index e0781ad..0000000 --- a/dux/src/priv/posix/read.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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_read(int const fd,void * const buf,dux_uwrd const count) { -# if defined(dux_os_freebsd) - return (dux_swrd)dux_syscall(SYS_read,fd,buf,count); -# elif defined(dux_os_linux) - return (dux_swrd)dux_syscall(__NR_read,fd,buf,count); -# endif -} diff --git a/dux/src/priv/posix/sigaction.c b/dux/src/priv/posix/sigaction.c deleted file mode 100644 index 8a0e259..0000000 --- a/dux/src/priv/posix/sigaction.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - 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 <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 deleted file mode 100644 index de80921..0000000 --- a/dux/src/priv/posix/write.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - 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 deleted file mode 100644 index f72aba0..0000000 --- a/dux/src/priv/start.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - 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 deleted file mode 100644 index 2ec5e36..0000000 --- a/dux/src/priv/syscall.S +++ /dev/null @@ -1,50 +0,0 @@ -/* - 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 deleted file mode 100644 index 43057f3..0000000 --- a/dux/src/raise.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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 :: Raise #%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 deleted file mode 100644 index 68fe284..0000000 --- a/dux/src/realloc.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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/dux/src/rnd.cc b/dux/src/rnd.cc deleted file mode 100644 index 4fdd940..0000000 --- a/dux/src/rnd.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - 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/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; - } - dux_ass("",static_cast<::dux::uwrd>(getrndret) == _sz); -} diff --git a/dux/src/setsighandl.cc b/dux/src/setsighandl.cc deleted file mode 100644 index a4131f6..0000000 --- a/dux/src/setsighandl.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* - 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 :: Set (default) -> #%i\n",sig); - sigact.sa_handler = SIG_DFL; - } - else { - ::dux::dbglog("dux.setsighandl :: Set %p -> #%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 deleted file mode 100644 index 512ecb4..0000000 --- a/dux/src/sleep.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - 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 :: Sleep " dux_printfuint64 "s\n",_sec); - 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(×pec,×pec) == -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 deleted file mode 100644 index 23647ff..0000000 --- a/dux/src/strcmp.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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 deleted file mode 100644 index ddb9271..0000000 --- a/dux/src/strcpy.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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 deleted file mode 100644 index 60fcffd..0000000 --- a/dux/src/strdup.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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 deleted file mode 100644 index e9c6d20..0000000 --- a/dux/src/streq.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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 deleted file mode 100644 index ab22f2e..0000000 --- a/dux/src/strlen.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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/dux/src/trap.cc b/dux/src/trap.cc deleted file mode 100644 index af20cf4..0000000 --- a/dux/src/trap.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - 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> - -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 - } -} - -# pragma GCC diagnostic ignored "-Wmissing-declarations" - -extern "C" auto dux_trap() -> void {::dux::trap();} diff --git a/update-checklist.txt b/update-checklist.txt deleted file mode 100644 index 53cec11..0000000 --- a/update-checklist.txt +++ /dev/null @@ -1,9 +0,0 @@ -- Update the version number in: - - "/dux/include/dux/base.h" - - "/CMakeLists.txt" - -- Add a new version entry in the changelog - -- Check all TO-DOs and complete any that can quickly be completed - -- Make sure the new changelog entry reflects the new changes; |