diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6a06028 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +*.opus filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.kra filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20fd9ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/ +/build_*/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f01720b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,79 @@ +stages: + - analyse + - test + - deploy + +variables: + GIT_SUBMODULE_STRATEGY: normal + +line_limit: + stage: analyse + allow_failure: true + image: registry.git.mel.vin/vermim/cicd/cicd/coreutils:0.1 + script: + - mkdir build + - cd build + - cmake -DDOC:STRING=OFF -DLINE_LIMIT:BOOL=ON -DWERROR:BOOL=ON .. + - make line_limit + +regex_check: + stage: analyse + allow_failure: true + image: registry.git.mel.vin/vermim/cicd/cicd/coreutils:0.1 + script: + - mkdir build + - cd build + - cmake -DDOC:STRING=OFF -DREGEX_CHECK:BOOL=ON -DWERROR:BOOL=ON .. + - make regex_check + +sphinx_html: + stage: test + image: registry.git.mel.vin/vermim/cicd/cicd/sphinx_html:0.3 + script: + - mkdir build + - cd build + - cmake -DWERROR:BOOL=ON .. + - make + artifacts: + paths: + - build/doc/html + +review: + stage: deploy + variables: + GIT_STRATEGY: none + only: + - master@shione/shione + dependencies: + - sphinx_html + image: registry.git.mel.vin/vermim/cicd/cicd/coreutils:0.1 + environment: + name: review/$CI_COMMIT_REF_NAME + url: https://shione.vermwa.re + on_stop: review_stop + script: + - mkdir -p ~/.ssh + - echo "$DOC_SSH_KNOWNHOSTS" > ~/.ssh/known_hosts + - eval $(ssh-agent) + - echo "$DOC_SSH_KEY" | ssh-add - > /dev/null + - mv build/doc/html public + - rsync -a --delete public/ 'web@shione.vermwa.re:' + +review_stop: + stage: deploy + variables: + GIT_STRATEGY: none + when: manual + dependencies: [] + image: registry.git.mel.vin/vermim/cicd/cicd/coreutils:0.1 + environment: + name: review/$CI_COMMIT_REF_NAME + action: stop + script: + - mkdir -p ~/.ssh + - echo "$DOC_SSH_KNOWNHOSTS" > ~/.ssh/known_hosts + - eval $(ssh-agent) + - echo "$DOC_SSH_KEY" | ssh-add - > /dev/null + - mkdir /tmp/empty + - rsync -a --delete /tmp/empty/ 'web@shione.vermwa.re:' + - rmdir /tmp/empty diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bd75922 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cicd/style"] + path = cicd/style + url = ../../../template/util/style.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..21091a1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,59 @@ +# 3.8.2 required because template/c requires it +cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR) +list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# set build type to release if none is specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +# options +option(LINE_LIMIT "Check files with line_limit." OFF) +option(REGEX_CHECK "Check files with regex_check." OFF) +option(WERROR "Make all warnings into errors." OFF) +if(NOT DEFINED DOC) + set(DOC html CACHE STRING + "The documentation type to generate." FORCE) +endif() + +# disable base languages +unset(PROJECT_LANGUAGES) + +project(shione + VERSION 0.0.0 + DESCRIPTION "shione" + LANGUAGES ${PROJECT_LANGUAGES}) +set(PROJECT_VERSION_SUFFIX "") # alpha/beta/rc, e.g. "-rc0" +set(PROJECT_VERSION "${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX}") +set(PROJECT_AUTHOR "renken") +set(PROJECT_COPYRIGHT "2021, renken") +set(PROJECT_MAIL "renken@verm.im") +# only set CMAKE variant when local name matches CMAKE name +# this avoids clashing when being used as a subproject +if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMAKE_PROJECT_VERSION "${PROJECT_VERSION}") + set(CMAKE_PROJECT_VERSION_SUFFIX "${PROJECT_VERSION_SUFFIX}") + set(CMAKE_PROJECT_AUTHOR "${PROJECT_AUTHOR}") + set(CMAKE_PROJECT_COPYRIGHT "${PROJECT_COPYRIGHT}") + set(CMAKE_PROJECT_MAIL "${PROJECT_MAIL}") +endif() +include(version) + +if(NOT DOC STREQUAL "OFF") + add_subdirectory(doc) +endif() + +if(${LINE_LIMIT}) + include(line_limit) +endif() + +if(${REGEX_CHECK}) + include(regex_check) +endif() + +if(${LINE_LIMIT} OR ${REGEX_CHECK}) + include(check) +endif() diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..61958cb --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + shione + Copyright (C) 2020 shione + + 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 . + +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 +. diff --git a/cicd/docker_targets/coreutils/Dockerfile b/cicd/docker_targets/coreutils/Dockerfile new file mode 100644 index 0000000..786afdb --- /dev/null +++ b/cicd/docker_targets/coreutils/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:stretch +ADD bootstrap.sh / +RUN /bootstrap.sh && rm /bootstrap.sh diff --git a/cicd/docker_targets/coreutils/Tagfile b/cicd/docker_targets/coreutils/Tagfile new file mode 100644 index 0000000..dee3c0b --- /dev/null +++ b/cicd/docker_targets/coreutils/Tagfile @@ -0,0 +1 @@ +registry.git.mel.vin:443/shione/shione/cicd/coreutils:0.0 diff --git a/cicd/docker_targets/coreutils/bootstrap.sh b/cicd/docker_targets/coreutils/bootstrap.sh new file mode 100755 index 0000000..2d6c23a --- /dev/null +++ b/cicd/docker_targets/coreutils/bootstrap.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +DEBIAN=stretch + +set -e + +printf '%s\n' \ + "deb http://ftp.debian.org/debian $DEBIAN-backports main" \ + > /etc/apt/sources.list.d/$DEBIAN-backports.list + +apt-get update + +apt-get dist-upgrade -y + +# backported cmake requires backported libuv1 +apt-get install --no-install-recommends -y \ + bash \ + ca-certificates \ + cmake/$DEBIAN-backports \ + coreutils \ + findutils \ + git \ + grep \ + libuv1/$DEBIAN-backports \ + make \ + openssh-client \ + rsync \ + sed + +apt-get autoremove -y +apt-get clean +rm -rf /var/lib/apt/lists/* diff --git a/cicd/docker_targets/sphinx_html/Dockerfile b/cicd/docker_targets/sphinx_html/Dockerfile new file mode 100644 index 0000000..786afdb --- /dev/null +++ b/cicd/docker_targets/sphinx_html/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:stretch +ADD bootstrap.sh / +RUN /bootstrap.sh && rm /bootstrap.sh diff --git a/cicd/docker_targets/sphinx_html/Tagfile b/cicd/docker_targets/sphinx_html/Tagfile new file mode 100644 index 0000000..3fb6c15 --- /dev/null +++ b/cicd/docker_targets/sphinx_html/Tagfile @@ -0,0 +1 @@ +registry.git.mel.vin:443/shione/shione/cicd/sphinx_html:0.0 diff --git a/cicd/docker_targets/sphinx_html/bootstrap.sh b/cicd/docker_targets/sphinx_html/bootstrap.sh new file mode 100755 index 0000000..f24045a --- /dev/null +++ b/cicd/docker_targets/sphinx_html/bootstrap.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +DEBIAN=stretch +PLANTUML=master + +set -e + +printf '%s\n' \ + "deb http://ftp.debian.org/debian $DEBIAN-backports main" \ + > /etc/apt/sources.list.d/$DEBIAN-backports.list + +apt-get update + +apt-get dist-upgrade -y + +# backported cmake requires backported libuv1 +apt-get install --no-install-recommends -y \ + ca-certificates \ + cmake/$DEBIAN-backports \ + curl \ + default-jre-headless \ + git \ + graphviz \ + libuv1/$DEBIAN-backports \ + make \ + python3-pip \ + python3-setuptools \ + python3-wheel + +# some font metapackages use recommends to install their subpackages +apt-get install -y \ + fonts-dejavu \ + fonts-liberation \ + fonts-noto + +ln -s /usr/bin/python3 /usr/local/bin/python +ln -s /usr/bin/pip3 /usr/local/bin/pip + +pip install \ + sphinx \ + sphinx_rtd_theme \ + sphinxcontrib-plantuml + +mkdir -p /opt/plantuml +for i in batik-all-1.7.jar jlatexmath-minimal-1.0.3.jar jlm_cyrillic.jar \ + jlm_greek.jar plantuml.jar +do + curl -Lf \ + -o /opt/plantuml/$i \ + https://git.mel.vin/mirror/plantuml/raw/$PLANTUML/$i +done + +printf '%s\n%s\n' \ + '#!/bin/sh' \ + 'exec java -jar /opt/plantuml/plantuml.jar "$@"' \ + > /usr/local/bin/plantuml +chmod +x /usr/local/bin/plantuml + +apt-get purge -y \ + curl + +apt-get autoremove -y +apt-get clean +rm -rf /var/lib/apt/lists/* diff --git a/cicd/style b/cicd/style new file mode 160000 index 0000000..68df132 --- /dev/null +++ b/cicd/style @@ -0,0 +1 @@ +Subproject commit 68df132153b7892f80ea09e41f9ce15ebc68f5f8 diff --git a/cmake/check.cmake b/cmake/check.cmake new file mode 100644 index 0000000..4671406 --- /dev/null +++ b/cmake/check.cmake @@ -0,0 +1,10 @@ +# add check target as a convience target to invoke all checks +add_custom_target(check) + +if(${LINE_LIMIT}) + add_dependencies(check line_limit) +endif() + +if(${REGEX_CHECK}) + add_dependencies(check regex_check) +endif() diff --git a/cmake/find_python_module.cmake b/cmake/find_python_module.cmake new file mode 100644 index 0000000..f8fe638 --- /dev/null +++ b/cmake/find_python_module.cmake @@ -0,0 +1,48 @@ +function(find_python_module module module_u) + +if(${module_u}_FOUND) + return() +endif() + +# do not override user-specified values +if(NOT ${module_u}_PATH) + # set the default in case nothing is found + set("${module_u}_PATH" "" CACHE STRING "Path to ${module}." FORCE) + + # A module's location is usually a directory, but for binary modules + # it's an .so file. + execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import os, re, ${module}; print(os.path.dirname(\ + re.compile('/__init__.py.*').sub('',${module}.__file__)))" + RESULT_VARIABLE "${module_u}_RESULT" + OUTPUT_VARIABLE "${module_u}_OUTPUT" + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + + # strip module directories to get the base path + # abc.foo.bar.xyz -> ... (three dots) + string(REGEX REPLACE "[^\\.]+" "" module_strip "${module}") + string(LENGTH "${module_strip}" module_strip) + # strip ${module_strip} times the final directory from path + if(module_strip GREATER 0) + # CMake's loops are inclusive so start at 1 + foreach(module_strip_i RANGE 1 ${module_strip}) + string(REGEX REPLACE "/[^/]+$" "" + "${module_u}_OUTPUT" "${${module_u}_OUTPUT}") + endforeach(module_strip_i) + endif() + + # if the exit code (RESULT) is non-zero python couldn't import module + if(NOT ${module_u}_RESULT) + set("${module_u}_PATH" "${${module_u}_OUTPUT}" CACHE STRING + "Path to ${module}." FORCE) + endif() +endif() + +if(NOT ${module_u}_PATH) + message(FATAL_ERROR "Could not find ${module}.") +endif() +set(${module_u}_FOUND ON CACHE BOOL "Found ${module}.") +mark_as_advanced(${module_u}_FOUND) +message(STATUS "Found ${module}: ${${module_u}_PATH}") + +endfunction(find_python_module) diff --git a/cmake/line_limit.cmake b/cmake/line_limit.cmake new file mode 100644 index 0000000..9d370c4 --- /dev/null +++ b/cmake/line_limit.cmake @@ -0,0 +1,4 @@ +add_custom_target(line_limit + COMMENT "Running line_limit checks" + COMMAND WERROR=${WERROR} ./cmake/line_limit.sh + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") diff --git a/cmake/line_limit.sh b/cmake/line_limit.sh new file mode 100755 index 0000000..ed59f33 --- /dev/null +++ b/cmake/line_limit.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# intermediate script to support extra options for line_limit.sh + +# current script dir +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +# support WERROR option +[[ $WERROR == "ON" ]] && set -e + +# call line_limit.sh to check repo +"$SCRIPT_DIR/../cicd/style/line_limit.sh" \ + -e '^build[^/]*/' \ + -e '^.*\.svg$' \ + -i "$SCRIPT_DIR/.." + +exit 0 diff --git a/cmake/plantuml.cmake b/cmake/plantuml.cmake new file mode 100644 index 0000000..fce66e8 --- /dev/null +++ b/cmake/plantuml.cmake @@ -0,0 +1,14 @@ +if(PLANTUML_FOUND) + return() +endif() + +find_program(PLANTUML_PATH + NAMES plantuml plantuml.bat + DOC "Path to PlantUML wrapper script.") + +if(NOT PLANTUML_PATH) + message(FATAL_ERROR "Could not find PlantUML.") +endif() +set(PLANTUML_FOUND ON CACHE BOOL "Found PlantUML.") +mark_as_advanced(PLANTUML_FOUND) +message(STATUS "Found PlantUML: ${PLANTUML_PATH}") diff --git a/cmake/regex_check.cmake b/cmake/regex_check.cmake new file mode 100644 index 0000000..f638496 --- /dev/null +++ b/cmake/regex_check.cmake @@ -0,0 +1,4 @@ +add_custom_target(regex_check + COMMENT "Running regex_check checks" + COMMAND WERROR=${WERROR} ./cmake/regex_check.sh + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") diff --git a/cmake/regex_check.sh b/cmake/regex_check.sh new file mode 100755 index 0000000..63b7e32 --- /dev/null +++ b/cmake/regex_check.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# intermediate script to support extra options for regex_check.sh + +# current script dir +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +# support WERROR option +[[ $WERROR == "ON" ]] && set -e + +# call regex_check.sh to check repo +"$SCRIPT_DIR/../cicd/style/regex_check.sh" \ + -e '^build[^/]*/' \ + -e '^.*\.svg$' \ + -r '(^$)|(^.*[^[:cntrl:][:blank:]]$)' \ + "$SCRIPT_DIR/.." +"$SCRIPT_DIR/../cicd/style/regex_check.sh" \ + -e '^build[^/]*/' \ + -r '(^$)|(^.*[^[:cntrl:][:blank:]]$)' \ + "$SCRIPT_DIR/.." + +exit 0 diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 0000000..0dbdb21 --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,62 @@ +if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git") + return() +endif() + +find_package(Git REQUIRED) + +# output style is: +# 846ffe7, no tag yet +# 846ffe7+, no tag yet, dirty +# 1.3.2, an exact tag +# 1.3.2+, an exact tag, dirty +# 1.3.2-1-g846ffe7, one commit since tag +# 1.3.2-1-g846ffe7+, one commit since tag, dirty +execute_process(COMMAND "${GIT_EXECUTABLE}" describe --dirty=+ --tags --always + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + OUTPUT_VARIABLE TMP_VER + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# if there is no git tag prefix the CMake version +if(TMP_VER MATCHES "^[0-9a-f]+\\+?$") + set(TMP_VER "${PROJECT_VERSION}-1-g${TMP_VER}") +endif() + +# error if CMakeLists.txt version does not match the latest tag +string(REGEX REPLACE "^(.*)-[0-9]+-g[0-9a-f]+\\+?$" "\\1" TMP_TAG "${TMP_VER}") +# also support dirty tags, e.g. 1.3.2+ +if(TMP_VER STREQUAL TMP_TAG) + string(REGEX REPLACE "^(.*)\\+$" "\\1" TMP_TAG "${TMP_VER}") +endif() +if(NOT PROJECT_VERSION STREQUAL TMP_TAG) + message(FATAL_ERROR "CMake project version and git tag mismatch! \ +CMake: ${PROJECT_VERSION}, Git tag: ${TMP_TAG}.") +endif() + +# replace "-1-g" with "-", turning it into e.g. 1.3.2-846ffe7+ +string(REGEX REPLACE "^(.*)-[0-9]+-g([0-9a-f]+\\+?)$" "\\1-\\2" + TMP_VER "${TMP_VER}") + +# only set CMAKE variant when local name matches CMAKE name +# this avoids clashing when being used as a subproject +set(PROJECT_VERSION "${TMP_VER}") +if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMAKE_PROJECT_VERSION "${PROJECT_VERSION}") +endif() + +# do not message if actual version did not change +if(NOT PROJECT_VERSION STREQUAL PROJECT_VERSION_PREV) + set(PROJECT_VERSION_PREV "${PROJECT_VERSION}" CACHE STRING + "Project version during previous cache build." FORCE) + mark_as_advanced(PROJECT_VERSION_PREV) + message(STATUS "Updated version to ${PROJECT_VERSION}.") +endif() + +unset(TMP_VER) +unset(TMP_TAG) + +# force a reconfigure when the git index changes +# dirty detection won't run every for every build so it may outdated +# when the index/staging area changes it will however trigger +# this balances configuration time and dirty index detection +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/.git/index") diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..4849d35 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +rsync -a --delete build/doc/html/ 'web@shione.vermwa.re:' diff --git a/doc/404.rst b/doc/404.rst new file mode 100644 index 0000000..2885d35 --- /dev/null +++ b/doc/404.rst @@ -0,0 +1,12 @@ +:orphan: + +Not found +========= + +.. note:: + Our hard-working Cirnos cannot find the requested resource! + +.. image:: _static/cirnos.png + :name: cirnos + :alt: cirnos + :align: center diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..8f738fc --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,74 @@ +set(DOC_SRC "${PROJECT_SOURCE_DIR}/doc") +set(DOC_DEST "${PROJECT_BINARY_DIR}/doc/${DOC}") +set(DOC_TMP "${PROJECT_BINARY_DIR}/tmp/doc") + +if(DOC STREQUAL "html") + set(EXTRA_PYTHON_MODULES "sphinx_rtd_theme") +else() + unset(EXTRA_PYTHON_MODULES) +endif() + +find_package(PythonInterp REQUIRED) +include(find_python_module) + +# do not change the ENV, doesn't work with add_custom_target +# https://cmake.org/Bug/view.php?id=5145 +if(ENV{PYTHONPATH}) + set(PYTHONPATH "$ENV{PYTHONPATH}") +else() + # PYTHONPATH disables defaults, manually append them + execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import sys; sys.stdout.write(':'.join(sys.path))" + OUTPUT_VARIABLE PYTHONPATH) +endif() + +foreach(module + sphinx + sphinxcontrib.plantuml + ${EXTRA_PYTHON_MODULES}) + string(TOUPPER "${module}" module_upper) + find_python_module("${module}" "${module_upper}") + set(PYTHONPATH "${${module_upper}_PATH}:${PYTHONPATH}") +endforeach(module) + +if(${WERROR}) + set(SPHINX_WERROR "-W") +else() + unset(SPHINX_WERROR) +endif() + +include(plantuml) + +configure_file( + "${DOC_SRC}/conf.py.in" + "${DOC_TMP}/sphinx/conf.py" + @ONLY) + +add_custom_target(doc ALL + COMMAND "${CMAKE_COMMAND}" -E echo + "Generating sphinx ${DOC} documentation" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${PYTHONPATH}" + "${PYTHON_EXECUTABLE}" -m sphinx -b "${DOC}" + -d "${DOC_TMP}/sphinx/doctrees" -j auto + -c "${DOC_TMP}/sphinx" -q ${SPHINX_WERROR} + "${DOC_SRC}" "${DOC_DEST}") +add_custom_command(TARGET doc POST_BUILD + COMMAND ; + COMMENT "Output at ${DOC_DEST}") + +add_custom_target(doc_nocache + COMMAND "${CMAKE_COMMAND}" -E echo + "Generating sphinx ${DOC} documentation, no cache" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${PYTHONPATH}" + "${PYTHON_EXECUTABLE}" -m sphinx -b "${DOC}" -E + -d "${DOC_TMP}/sphinx/doctrees" -j auto + -c "${DOC_TMP}/sphinx" -q ${SPHINX_WERROR} + "${DOC_SRC}" "${DOC_DEST}") +add_custom_command(TARGET doc_nocache POST_BUILD + COMMAND ; + COMMENT "Output at ${DOC_DEST}") + +add_custom_target(doc_clean + COMMAND "${CMAKE_COMMAND}" -E remove_directory "${DOC_DEST}" + COMMAND "${CMAKE_COMMAND}" -E remove_directory + "${DOC_TMP}/sphinx/doctrees") diff --git a/doc/_static/cirnos.png b/doc/_static/cirnos.png new file mode 100644 index 0000000..6f13e3a --- /dev/null +++ b/doc/_static/cirnos.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aad89e8f353c0415f7bdc97c4151e4cf2b65ec26181963e21996bf2ec3694895 +size 71046 diff --git a/doc/_static/nono.png b/doc/_static/nono.png new file mode 100644 index 0000000..137d52b --- /dev/null +++ b/doc/_static/nono.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f4f6725b1b1c8cafdbc8fbecea299f6bba3c5be2a940fb6651503b9808997a3 +size 123997 diff --git a/doc/_static/renken.asc b/doc/_static/renken.asc new file mode 100644 index 0000000..c54d3c5 --- /dev/null +++ b/doc/_static/renken.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF/3E7sBEADUyyOGhxeQ08+Spkjra0HTJixdVj94gI1T6s++rsdkaOfuO7aL +LQmoQq1GrQU919s6aCzAONAH991o1w515GigmSC/zT9/+YM1DvuuypeD1OHh7x2S +csYvoazKWXhHXLJamq0BmD1PVMrz2o63AkQ2lPrQNN2MvJQ+8NZ9Qs3sDkxrbTFA +iDNrrCucPxtGisLi8TdmKVwzjQFHdZKA4oDUxzcHNLhVx7zIJP52ZOPaeIBLESOy +1/KKYgQr2mC3qXCEIBOlHdp6yfCraln5ysFqebRqFtua1gQ9NaU/Dko94zFxq1jO +hE9BgkFYOZAqLOkeQHxYF+X1thAPyCiehmGZkuZoTWt6cqF6BGhK9akKEFdNyRby +32jbcVKF+gBeWqf+UKqkiAELKvpRaDkh3dbSdVm2Q/t1szyUFxgqCo/7c1MwIA0S +rbSql6COa3zWdWNhzsN4xqYq2414IYPeUJVi/CGZr0NP0pe/YwX5QLPKYlQxHw3f +B0Rr2iZOo07AHUCR9tvZldcpiaVjac3NhPxE3JdtiqHGzwPuolEwiN3LowS/NMh3 +jzeIVGOdX9eMx618+JUQbV7R5xZfDEuNuzAp02i95xIdtu3rlmjamn9keTC0wfYg +FAoYRWgKqACPYbfPTjlATPQ3DEuuuXWXbEe27fNMj8F2GFb7I9yrn8nzAQARAQAB +tBdSZW5rZW4gPHJlbmtlbkB2ZXJtLmltPokCVAQTAQoAPhYhBKtL+MgJCC8EcPSW +GZtfTiyb9t1DBQJf9xO7AhsDBQkB4TOABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEJtfTiyb9t1DEnQQAKof0cs3zBjgRGNHrNMpknq8e2wYMdJvn6cJ0BFaYFz5 +F7gq6ZVI7fIsqDDz88ieGBZ3GuBbss4EaenkHECzg/c3uyfQ1kK5Rd0fqk6m7Lkq +9izZAzU8/8817Zyr9L4z2fAySEJNGyBI5q8xJW2ZM/oX8dozyGZQabSJPOPCS9hV +8nTRSvW6Q02qleUw0Bzg/cz/LAbBGAs+7gjhpIz6xZnEmmzb/hIUVTY7KPVHaa/E +UTgNgN0ktYNUv1iO+jf/ayHtDdND2g3PB+Sg+Ym7UzwWl+4MqDbhRInWNv9pIT8r +3pX2cTKnS7dHhubOuLWk/W3GssNJ4d9nJqdg+bv1PN3Yv89dlZbG1yWq+eF+Cgdy +QNetYg/+pLziJt6mBV1gC1483QwBSafDL8sPxPiSHft9dbf5A8sL6nZC8cX0sNop +q6WaBc7QeUC0EBqU3xD7k90kWW9Tas1KFWjWINa+SDy+NjHoiyl6ai9ocBnr7KwB +omQRUMv8vGDGEEw0naguejekT6pT9CJSxS4ErIsj8FIzgTi1MaWcJkXnVxJ00ME7 +1rIDWz1w1oA7aagZCu3mJNhpzAzV3HmPzo1qCHk2KKq6FUT+OXEAhjYV+dC2wEId +HcrIm71SjpHtnnm8ASt2ofXkZODvMGmxZDtGw7vU578LUpB0nEixkNb3CmPX39Dr +uQINBF/3E7sBEACj9syD3Svuyu/D0EMqAxSwrKAdgV0XQTV/XAeykRZKvdxjr5nn +8VP5K/7i2gW0t8hxhGsCMx+Vc9Skn/yuAjJYGOyssT8mOav1tBXMnIZWF8hsLXOW +InPf8d39tgVGL7AzmMd1FYkVMgJEPS7Y6spEmK9kkQsa6kRIQic5K6zrCOWH3n21 +/jH1pbmWBr5QZEVqEk+MlKGUpq2pvZBVzglch3QifO3RtvC819oZ7nKpBtVYLmMQ +g9XngAckayNa+Km+CLsKRn1xqWduxEqyvcCCLRppxQ5abmlH7955RfEjLfSFclKq +JX1YT+LOTcZnrRfslFv1UgNPqPEdSqcuZbAnrIDr9HnBU3Fym4WxM2HkrJAnzvPC +C9hsmSB/BuvoSgw5gqxZJz7AWnt7o9GkyvFWFplYTHNOtLddC3vMdqpYTXnqsj/N ++aDEkxSCPkj+iDA5P3A/fjYB/9Zfl9rf38073bhTiuacoPBM0ZWdBIvIjVcU+xoZ +s4K6TRrOZxUGSBVSZcgTX1lEY8kMFvrN2XyajxyChuCL3624r2tteqYPw1x5JUrS +PFn0iSeOIpDgOecf4oInJfMkfvExG4v5PKW+5mGC1At/QnBO7tjlmkgiK06pD2kC +1XEOB+dNEKWT7JjUKqI2KVFIioze99WWG8qcB0g47PJ34jI6FKTwEcaF4QARAQAB +iQI8BBgBCgAmFiEEq0v4yAkILwRw9JYZm19OLJv23UMFAl/3E7sCGwwFCQHhM4AA +CgkQm19OLJv23UPmixAAivOsNws3uAE2F+LlrZY4Mu7nqCArVnhizqHsJdjxCAVX +HGKPDrkgQCUCnQ5+rhHKwoBZOxJ/9FeHlHg/yVtgQuflIw1umeEqhNuYQe/EhtsC +fJVD6RUNsbAGKwPKIvZ0G2pCYk8esmvzwFZwIc4nrXQKZOI6JPKvhs1gT0/MP/Ir +0k91WyP8CM2vcNPUp+PCGuS1v/THVJAH9CFGJ8XuF/ejftOlloL2D4OlBylexYEv +apxqaVa/azQy11NsNCNVipk8m8VMYIXKWEtk6EJIsc3Ztf9fFwFei3FZGd8fe22L +H+tFqtDqmlBeC4NHN1JKgiyNSOaHzUmSTCqaRDxf8/7tOtNIwAwJuxmXSDPBtCJn +LsaBF5jOOM/fySR9WVLmW1vgRgikeZsLCh3E07ZOroDhoTTdbuGewEb159jeLhne +5W6wcOPoE7W+XvQsTLO8XTBD3pfmnLJrw1R629z70I1V8nc/ez2+RwpKvHocevEb +jwPhaE1QrW3re7hrhvSNH64xJiaPozTuWSsJ1rq16DFWdznCis2AGLNkFxZowhjn +5fInQYKxbmBYq0tIKYAbBZYRN5UoYZubcyKmcfs5zbjKt1c/6ERHrXE3rfPUX5wS +VT7WZETW+yjzyk81C1fGH6nnWIueou2po0DarTz43vfzw4b81S6u2C/qU8sZUuM= +=5I9v +-----END PGP PUBLIC KEY BLOCK----- diff --git a/doc/_static/renkenwaifu.kra b/doc/_static/renkenwaifu.kra new file mode 100644 index 0000000..fcfdbfa --- /dev/null +++ b/doc/_static/renkenwaifu.kra @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66efe729e37bd83964485a8dde40bc38a72dd54bd54dea1c983fe7588b7b0113 +size 13824506 diff --git a/doc/_static/renkenwaifu.png b/doc/_static/renkenwaifu.png new file mode 100644 index 0000000..70f49f5 --- /dev/null +++ b/doc/_static/renkenwaifu.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ceb41dab47abd9a562c86a9fc7d1b04305f7501ebdc4ba300202d7108f22f49 +size 1540516 diff --git a/doc/_static/shione.jpg b/doc/_static/shione.jpg new file mode 100644 index 0000000..453112e --- /dev/null +++ b/doc/_static/shione.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3632e4d2c4db72d126332d9418076f480c6e7f951040cecf0f1d8db0344c1120 +size 182726 diff --git a/doc/_static/theme_overrides.css b/doc/_static/theme_overrides.css new file mode 100644 index 0000000..a2fcbf4 --- /dev/null +++ b/doc/_static/theme_overrides.css @@ -0,0 +1,9 @@ +/* override table width restrictions */ +@media screen and (min-width: 767px) { + .wy-table-responsive table td, .wy-table-responsive table th { + white-space: normal !important; + } + .wy-table-responsive { + overflow: visible !important; + } +} diff --git a/doc/about.rst b/doc/about.rst new file mode 100644 index 0000000..a2c5c48 --- /dev/null +++ b/doc/about.rst @@ -0,0 +1,49 @@ +About +===== + +.. contents:: + :depth: 3 + +Renken +------ + +Hi, I'm Renken, 22 years old from Algeria and I manage shione. I like c, anime +girls and other things that I may talk about in the future. I work at vermware +on various interesting projects. + +I enjoyed a university-free year focusing on vermware back in 2020. As of 2021, +I am back to university. + +You can email me at renken@verm.im and I'll be glad to reply. + +PGP +~~~ + +My `public key`_ fingerprint: + + AB4B F8C8 0908 2F04 70F4 9619 9B5F 4E2C 9BF6 DD43 + +.. _public key: _static/renken.asc + +Avatar +~~~~~~ + +I usually have the following picture of Nonoka Sasaki as my avatar + +.. image:: _static/nono.png + :name: nonoka + :alt: nonoka + :align: center + +Shione +------ + +The name Shione means "sound of tide" (汐音). She is Yune's sister from +Ikoku Meiro no Croisée. + +.. image:: _static/shione.jpg + :name: shione + :alt: shione + :align: center + :width: 400px + :height: 400px diff --git a/doc/conf.py.in b/doc/conf.py.in new file mode 100644 index 0000000..bfd7856 --- /dev/null +++ b/doc/conf.py.in @@ -0,0 +1,197 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# mel.vin GitLab documentation build configuration file, created by +# sphinx-quickstart on Mon Jul 10 23:38:21 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinxcontrib.plantuml'] + +# plantuml config +plantuml = '@PLANTUML_PATH@ -config "@PROJECT_SOURCE_DIR@/doc/plantuml.cfg"' +plantuml_output_format = 'svg_img' +plantuml_latex_output_format = 'pdf' + +# Add any paths that contain templates here, relative to this directory. +templates_path = [] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = '@PROJECT_NAME@' +copyright = '@PROJECT_COPYRIGHT@' +author = '@PROJECT_AUTHOR@' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@PROJECT_VERSION@' +# The full version, including alpha/beta/rc tags. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'colorful' + +# The name of a reST role to use as the default role, that is, for text marked +# up `like this`. The default role can always be set within individual +# documents using the standard reST default-role directive. +default_role = 'any' + +# The default language to highlight source code. +highlight_language = 'rst' + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# + +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +html_theme_options = { + 'font_family': 'Inconsolata', + 'font_size': '16px', + 'show_powered_by': 'false', + 'description': 'managed by @PROJECT_AUTHOR@', + 'show_related': True, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['@DOC_SRC@/_static'] + +# Fix table line wrapping for RTD theme +# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html +# https://github.com/rtfd/sphinx_rtd_theme/pull/432 +html_context = { + 'css_files': ['_static/theme_overrides.css'] +} + + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'about.html', + 'navigation.html', + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + ] +} + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = '@PROJECT_NAME@' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Underscores can cause issues in the generated LaTeX. +latex_prj_esc = '@PROJECT_NAME@'.replace("_", "\\_") +latex_aut_esc = '@PROJECT_AUTHOR@'.replace("_", "\\_") + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, '@PROJECT_NAME@.tex', latex_prj_esc, + latex_aut_esc, 'manual'), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, '@PROJECT_NAME@', '@PROJECT_DESCRIPTION@', + '@PROJECT_AUTHOR@', 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@', + '@PROJECT_AUTHOR@', '@PROJECT_NAME@', + '@PROJECT_DESCRIPTION@', 'Documentation'), +] diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..8fcdfa8 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,9 @@ +Welcome to shione! +================== + +.. toctree:: + :glob: + :maxdepth: 1 + + about + */index diff --git a/doc/log/de/ch1.rst b/doc/log/de/ch1.rst new file mode 100644 index 0000000..223acee --- /dev/null +++ b/doc/log/de/ch1.rst @@ -0,0 +1,158 @@ +Chapter 1: introduction +======================= + +Cognates +-------- + +A cognate is a word that is derived from the same original form such as kühl and +cool. We'll explore some consonant relationships that exist between German and +English to make guessing more accurate and faster but of course, always consider +checking the dictionary for the definitive answer. + +.. list-table:: Cognates + :header-rows: 1 + + * * German + * English + * Examples + * * f, ff (medial or final) + * p + * hoffen - to hope, scharf - sharp + * * pf + * p, pp + * Apfel - apple, Pfeife - pipe + * * b (medial or final) + * v or f + * geben - to give, halb - half + * * d + * th + * Ding - thing + * * ch + * k + * Buch - book, machen - to make, suchen - to seek + * * cht + * ght + * Macht - might, Sicht - sight, Recht - right, Nacht - night + * * g + * y or i + * sagen - to say, legen - to lay, Nagel - nail, fliegen - to fly + * * k + * c + * kommen - to come, kritisch - critical + * * s, ss, ß (medial or final) + * t + * hassen - to hate, grüßen - to greet, besser - better, Fuß - foot + * * tz, z + * t + * Katze - cat + * * t + * d + * trinken - to drink, kalt - cold, Tochter - daughter + +Note that sometimes it may require some flexibility with vowels to get the +correct word e.g., hören - to hear. Try to figure out the following words: Haus, +lassen, Sonne, Wort. + +Good? What about Pfefferminze and tanzen (try your luck with stripping -n/-en if +you think it's a verb in its infinitive form) + +Okay let's learn proverbs. Well, first there's this thing with German where it +is possible to "glue" multiple words to produce another word referred to as +compounds for example Sprichwörter means proverbs! look both of them up. Now for +the actual proverbs. + +* Blut ist dicker als Wasser. Blood is dicker(thicker) als(as) + Wasser(ss->t). +* Reiche Leute(people) haben fette Katzen. + + +Book titles! Buchtitel, apparently used for both singular and plural. + +* Yasmina Khadra, was der Tag der Nacht schuldet (haven't read it yet by the + way). + +Genders +------- + +.. note:: + Find a way to ease the process of memorizing these? being able to + quickly remember and map the endings would be very helpful. + +Complex stuff, unsure how to deal with it other than just practicing it often. +But with what? + +It's very important to know what your subject's gender is to understand the +context of the passage in hand. The corresponding German definite articles are +as follows + +.. list-table:: Genders articles + :header-rows: 1 + + * * Gender + * Article + * * Masculine + * der + * * Feminine + * die + * * Neuter + * das + * * Plural + * die + +Masculine +^^^^^^^^^ + +1. Nouns denoting male beings. +2. Most nouns ending with -er that are agents of a specific activity e.g., der + Computer. +3. The days, months and seasons. Look them up! +4. Nouns ending in -ig, -ich, -ing, -ast, -mus e.g., König (king), der + Socialismus (Socialism). +5. Points of compass. Norden, Süden, Oster und Westen. + +Feminine +^^^^^^^^ +1. Nouns denoting female beings. +2. Nouns of most trees, fruits and flowers. Look your favorites up! +3. Nouns ending with -er, -ie, -ik, -in, -ion, -hiet, kiet, -schaft, -tät, + -ung, -ur e.g., die Gesundheit (health), die Gesellschaft (society) und die + Hoffung. + +Neuter +^^^^^^ + +.. note:: + Diminutive nouns usually have an umlaut if the stem vowel is a, o, u or + au so a becomes ä... + +1. Nouns with diminutive endings -chen, -lein e.g., das Buch -> das Büchlein, + das Männlein. +2. Most nouns of foreign origin that end in -o e.g., das Auto. +3. Infinitives used as a noun e.g., das Kommen. +4. Nouns ending with -ium, -um e.g., das Vism. + +Compounds +--------- + +New words in German sometimes can be formed by combining simpler words. Some of +these words can be particularly graphic. For example. + +* Abend (evening) + Land (country) = (occident). +* Morgen + Land = (orient). +* Morgen + Röte = (dawn). +* Eier (eggs) + Auflauf(crowd) = Eierauflauf (soufflé). + +The gender of the noun is determined by *its final component*. Thus, even in a +word as long as Unfallversicherungsgesellschaft (accident-insurance-society), +the article will be *die* because the suffix *-schaft* is feminine. This seems +difficult... + +* Standard German is known as Hochdeutsch, try figuring that out. Northen dialects + are referred to as Platt which you *should* be able to guess. +* Sie haben eine nette Dreizimmerwohung etwa 10 kilometer von der Stadtmitte. +* Deutschland ist eine Bundesrepublic in diverse Länder oder Bundesländer + unterteilt. Die Länder habt lokal Kontrolle uber Bildung und jeder hat sein + Landesregierung. + +Plural +------ diff --git a/doc/log/de/index.rst b/doc/log/de/index.rst new file mode 100644 index 0000000..ddb01f0 --- /dev/null +++ b/doc/log/de/index.rst @@ -0,0 +1,9 @@ +German notes +============ + +.. toctree:: + :glob: + :maxdepth: 1 + + ch1 + pronunciation diff --git a/doc/log/de/pronunciation.rst b/doc/log/de/pronunciation.rst new file mode 100644 index 0000000..d9cb045 --- /dev/null +++ b/doc/log/de/pronunciation.rst @@ -0,0 +1,92 @@ +Pronunciation guide +=================== + +This, in addition to the tables provided by Colloquial German, should serve as a +good document for how German pronunciation is like. Of course, you *should* +always look up the pronunciation in its audio format and/or learn how to read +IPA table efficiently to improve your pronunciation skills. + +This is also helpful to have a, sometimes misleading, sometimes correct guess of +the word's definition simply by saying them. For example, jung is pronounced +young and indeed does mean young. + +Keep in mind that all German nouns are capitalized e.g., Buch for book. + +.. contents:: + +Vowels +------ + +.. note:: + Keep in mind that I myself don't know most of these words. They're used + to simply give an example on how German sounds like in a way. It'd be + good if you pick up a word or two from this guide. I don't think you'll + be revisiting this page much. Maybe I'll consider updating the tables + with better/more fitting examples that you *may* find interesting. + +Vowels are either short or long like most languages. They are long when + +* They are doubled: Paar (Pair), Haar (hair), Schnee (Snow). +* They are followed by h: sehen (to look. Sehen is the noun view, notice the + capitalization matters!), Jahr (year), Ohr (ear). +* They are followed by a single consonant: gut (good), rot (red). + +They are shower when + +* They are followed a double consonant: Bett (bed), Mann (man), hoffen (to + hope). +* They are followed by two or more consonants: sitzen (to sit), ernst (serious, + look it up!). + +.. list-table:: Examples + :header-rows: 3 + + * * Vowel + * Type + * English equivalent sound + * German words + * * a + * long + * father + * Vater, haben, sagen + * * a + * short + * hot + * Vasser, Hand, alt + * * e + * long + * may + * See, geben + * * e + * short + * let + * Ende + * * i + * long + * greet + * Tiger, Universität + * * i + * short + * sit + * ist, dick, Mitte, Mittag, Mittwoch + * * ie + * long + * similar to here, look up how the following are pronounced. + * Bier, hier, fliegen, liegen + * * o + * long + * open + * Sohn, Brot, Segelboot + * * o + * song + * Sonne, Sommer + * (none) + * * u + * long + * dune + * Blume, Pudel, Handschuh + * * u + * short + * bush + * Mutter, und, unter + diff --git a/doc/log/index.rst b/doc/log/index.rst new file mode 100644 index 0000000..225961d --- /dev/null +++ b/doc/log/index.rst @@ -0,0 +1,10 @@ +Weblog +====== + +Notes from the underground. + +.. toctree:: + :glob: + :maxdepth: 1 + + */index diff --git a/doc/log/mqtt/index.rst b/doc/log/mqtt/index.rst new file mode 100644 index 0000000..cbe05e7 --- /dev/null +++ b/doc/log/mqtt/index.rst @@ -0,0 +1,50 @@ +MQTT +==== + +I first came across the MQTT protocol when I was looking for possible +alternative ideas and implementations to Syncplay. The key concept was that +video players such as mpv would connect to a central server, share information +about their media they're playing and synchronize their state with other peers. + +MQTT stands for Message Queuing Telemetry Transport and is an open OASIS and ISO +standard. It is designed to be lightweight and primarily for as a +publish-subscribe protocol which is what synchronization-based software such as +Syncplay *should* use. Another aspect of MQTT that makes it a viable design +option for media synchronization is its simplicity of design. That leaves the +implementer with a small well-defined logic to implement which means higher +chances of an efficient implementation and less unintentional errors. It also is +reasonable to go for a minimal transport protocol to provide a minimal service +such as media synchronization. + +I'll be reading through the standard version 5.0.0 published in 07 March 2019 +and trying to provide a UML-based representation of the MQTT standard with few +notes to the C implementation. Keep in mind that at the time of writing this, I +do not plan on implementing myself but I believe these notes would be helpful +for anyone wishing to implement MQTT themselves. + +Another note to keep in mind is that I do not have prior MQTT experience so I'm +not familiar with "best solutions" or "practice workarounds". I'll solely view +MQTT through the lens of the standards I have downloaded. Possible notes *may* +be added in the future. + +* Keep in mind that I'm by no means an expert and have very little experience + with real-word software. I'll be researching things I do not understand and + share my explanation here if possible. I suggest you double-check every + information provided here as well in order to spot any misconception or + misunderstanding. + +* Do note expect a strict and regulated publishing schedule, I'll only read the + standard and write about it in my free time whenever I wish. You *may* + contribute if you wish too. Alternatively you may advance on your own. + +* I *may not* respect the styling and indentation of the standard e.g., I *may* + choose to merge a sub-header back with its parent-head. + +Below are notes about each chapter in separate pages in the order provided by +the standard. + +.. toctree:: + :glob: + :maxdepth: 1 + + */index diff --git a/doc/log/mqtt/intro/app_msg.uml b/doc/log/mqtt/intro/app_msg.uml new file mode 100644 index 0000000..2c9950a --- /dev/null +++ b/doc/log/mqtt/intro/app_msg.uml @@ -0,0 +1,3 @@ +@startuml + +@enduml diff --git a/doc/log/mqtt/intro/client.uml b/doc/log/mqtt/intro/client.uml new file mode 100644 index 0000000..8c4abca --- /dev/null +++ b/doc/log/mqtt/intro/client.uml @@ -0,0 +1,9 @@ +@startuml + +Client -> Server: Establishes a network connection +Client -> Server: Publishes an application mesage +Client -> Server: Subscribes to request application messages +Client -> Server: Unsubscribes to remove a request for application messages +Client -> Server: Closes the network connection + +@enduml diff --git a/doc/log/mqtt/intro/index.rst b/doc/log/mqtt/intro/index.rst new file mode 100644 index 0000000..7d35aa8 --- /dev/null +++ b/doc/log/mqtt/intro/index.rst @@ -0,0 +1,95 @@ +Introduction +============ + +.. contents:: + +Terminology +----------- + +MQTT is a server-client protocol in which all clients *must* connect to a server +in order to exchange information which have to go through the server. + +Network connection +~~~~~~~~~~~~~~~~~~ + +The standard defines network connection as the following. + +:: + + A construct provided by the underlying transport protocol that is being + used by MQTT. + * It connects the Client to the Server. + * It provides the means to send an ordered, lossless, stream of bytes in + both directions. + +I believe that this definition was mainly provided as to not limit the network +connection, specifically the network protocol, to TCP as it is possibly the most +common network protocol used when implementing MQTT. You can emulate the bullet +points under non-TCP network protocols e.g., UDP and implement MQTT on top of +it. + +Session +~~~~~~~ + +:: + + A stateful interaction between a Client and a Server. Some Sessions last + only as long as the Network Connection, others can span multiple + consecutive Network Connections between a Client and a Server. + +This allows for the possibility of attempting re-connection after it has been +lost to preserve the same session. + +Application message +~~~~~~~~~~~~~~~~~~~ + +The information sent between clients through servers is called the application +message which is carried by the MQTT protocol across the network. It contains +payload data, a Quality of Service (QoS), a collection of properties and a topic +name. + +Subscription +^^^^^^^^^^^^ + +A subscription comprises a topic filter and a maximum QoS. A subscription is +associated with a single session. A session can contain more than one +subscription. Each subscription within a session has a different topic filter. + +Shared subscription can be associated with more than one session. I assume this +is used for the case of multiple servers? I don't see the need to have multiple +sessions to the same server but it is allowed by the standard. + +Wildcard subscription is a subscription with a topic filter containing one or +more wildcard characters. This allows the subscription to match more than one +topic name. Basically ``*`` in regular expression. + +write UML diagram about user <-- session 0..* -- 1..1 subscription + +Topic name +^^^^^^^^^^ + +The label attached to an application message which is matched against the +subscriptions known to the server. This is up to the application to use it +efficiently. In the case of media synchronization, would you rather use do +central topics e.g., ``/media/filename`` and users push to that topic or would +you do per-user topics ``/renken/media/filename`` and only ``renken`` can +publish to that topic. Similar ideas to that come to mind I guess. + +Topic filter +^^^^^^^^^^^^ + +An expression contained in a subscription to indicate an interest in one or more +topics. A topic filter can include wildcard characters. + +Client +~~~~~~ + +As discussed before, in MQTT, the client can only communicate with a server and +not with other clients. Note that the client is not limited to a single server. +It also not limited to a fixed number of application messages published or +requested. + +The server acts as an intermediary between clients which publish application +messages and clients which have made subscriptions. + +.. uml:: client.uml diff --git a/doc/misc/index.rst b/doc/misc/index.rst new file mode 100644 index 0000000..6d08214 --- /dev/null +++ b/doc/misc/index.rst @@ -0,0 +1,8 @@ +Miscellaneous +============= + +.. toctree:: + :glob: + :maxdepth: 1 + + */index diff --git a/doc/misc/p/index.rst b/doc/misc/p/index.rst new file mode 100644 index 0000000..37a28fe --- /dev/null +++ b/doc/misc/p/index.rst @@ -0,0 +1,30 @@ +Pictures +======== + +.. contents:: + :depth: 3 + +Happy birthday!! +---------------- + +I'd like to thank pika and verm for this lovely picture, it never fails to +put a smile on my face. + +Hacker/Artist pika can be found on `pixiv`_. + +.. _pixiv: https://www.pixiv.net/en/users/46770896 + +.. image:: ../../_static/renkenwaifu.png + :name: nonoka-birthday + :alt: nonoka-birthday + :align: center + :width: 407.5px + :height: 671.75px + + +Krita +~~~~~ + +You can find the original krita file `here`_! + +.. _here: ../../_static/renkenwaifu.kra diff --git a/doc/plantuml.cfg b/doc/plantuml.cfg new file mode 100644 index 0000000..b07eefd --- /dev/null +++ b/doc/plantuml.cfg @@ -0,0 +1,96 @@ +skinparam ActivityBackgroundColor White +skinparam ActivityBorderColor Black +skinparam ActivityDiamondBackgroundColor #e6e6e6 +skinparam ActivityDiamondBorderColor Black +skinparam ActivityDiamondFontStyle Italic +skinparam ActorBackgroundColor White +skinparam ActorBorderColor Black +skinparam AgentBackgroundColor White +skinparam AgentBorderColor Black +skinparam ArrowColor Black +skinparam ArtifactBackgroundColor White +skinparam ArtifactBorderColor Black +skinparam BackgroundColor White +skinparam BoundaryBackgroundColor White +skinparam BoundaryBorderColor Black +skinparam CardBackgroundColor White +skinparam CardBorderColor Black +skinparam ClassBackgroundColor White +skinparam ClassBorderColor Black +skinparam ClassHeaderBackgroundColor White +skinparam CloudBackgroundColor White +skinparam CloudBorderColor Black +skinparam CollectionsBackgroundColor White +skinparam CollectionsBorderColor Black +skinparam ComponentBackgroundColor White +skinparam ComponentBorderColor Black +skinparam ControlBackgroundColor White +skinparam ControlBorderColor Black +skinparam DatabaseBackgroundColor White +skinparam DatabaseBorderColor Black +skinparam EntityBackgroundColor White +skinparam EntityBorderColor Black +skinparam FileBackgroundColor White +skinparam FileBorderColor Black +skinparam FolderBackgroundColor White +skinparam FolderBorderColor Black +skinparam FrameBackgroundColor White +skinparam FrameBorderColor Black +skinparam IconPackageBackgroundColor White +skinparam IconPrivateBackgroundColor White +skinparam IconProtectedBackgroundColor White +skinparam IconPublicBackgroundColor White +skinparam InterfaceBackgroundColor White +skinparam InterfaceBorderColor Black +skinparam LegendBackgroundColor White +skinparam LegendBorderColor Black +skinparam NodeBackgroundColor White +skinparam NodeBorderColor Black +skinparam NoteBackgroundColor #e7f2fa +skinparam NoteBorderColor #6ab0de +skinparam ObjectBackgroundColor White +skinparam ObjectBorderColor Black +skinparam PackageBackgroundColor White +skinparam PackageBorderColor Black +skinparam PageBorderColor Black +skinparam ParticipantBackgroundColor White +skinparam ParticipantBorderColor Black +skinparam PartitionBackgroundColor White +skinparam PartitionBorderColor Black +skinparam QueueBackgroundColor White +skinparam QueueBorderColor Black +skinparam RectangleBackgroundColor White +skinparam RectangleBorderColor Black +skinparam SequenceBoxBackgroundColor White +skinparam SequenceBoxBorderColor Black +skinparam SequenceDividerBackgroundColor White +skinparam SequenceDividerBorderColor Black +skinparam SequenceGroupBackgroundColor White +skinparam SequenceGroupBodyBackgroundColor White +skinparam SequenceGroupBorderColor Black +skinparam SequenceLifeLineBackgroundColor #e6e6e6 +skinparam SequenceLifeLineBorderColor Grey +skinparam SequenceReferenceBackgroundColor White +skinparam SequenceReferenceBorderColor Black +skinparam SequenceReferenceHeaderBackgroundColor White +skinparam StackBackgroundColor White +skinparam StackBorderColor Black +skinparam StateBackgroundColor White +skinparam StateBorderColor Black +skinparam StereotypeABackgroundColor White +skinparam StereotypeABorderColor Black +skinparam StereotypeCBackgroundColor White +skinparam StereotypeCBorderColor Black +skinparam StereotypeEBackgroundColor White +skinparam StereotypeEBorderColor Black +skinparam StereotypeIBackgroundColor White +skinparam StereotypeIBorderColor Black +skinparam StereotypeNBackgroundColor White +skinparam StereotypeNBorderColor Black +skinparam StorageBackgroundColor White +skinparam StorageBorderColor Black +skinparam SwimlaneBorderColor Black +skinparam TitleBackgroundColor White +skinparam TitleBorderColor Black +skinparam UsecaseBackgroundColor White +skinparam UsecaseBorderColor Black