From aa767776df63fcea8293a50c22aa4f5b46028709 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 7 Jul 2024 18:01:29 -0500 Subject: [PATCH] Lots of doc improvements --- README.rst | 8 +- docs/c/bcd.rst | 2 +- docs/c/digits.rst | 6 +- docs/c/fibonacci.rst | 4 +- docs/c/iterator.rst | 2 +- docs/c/macros.rst | 22 +-- docs/c/primes.rst | 6 +- docs/csharp.rst | 8 +- docs/index.rst | 315 +++++++++++++++++++++++-------------------- docs/rust/p0001.rst | 2 +- docs/rust/p0002.rst | 2 +- 11 files changed, 197 insertions(+), 180 deletions(-) diff --git a/README.rst b/README.rst index e6ee1358..422a8c06 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ LivInTheLookingGlass’s Project Euler solutions ============================================== -.. |C| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg +.. |Ci| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml -.. |C#| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg +.. |C#i| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml .. |JavaScript| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg :target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml @@ -29,12 +29,12 @@ LivInTheLookingGlass’s Project Euler solutions +------------+---------------------+--------------+---------------+ | Language | Version | Solved | Status | +============+=====================+==============+===============+ -| C | C11+ in: ``gcc``, | 17 / |total| | |C| | +| C | C11+ in: ``gcc``, | 17 / |total| | |Ci| | | | |br| ``clang``, | | | | | ``msvc``, |br| | | | | | ``pcc``, ``tcc`` | | | +------------+---------------------+--------------+---------------+ -| C# | .NET 2+ | 2 / |total| | |C#| | +| C# | .NET 2+ | 2 / |total| | |C#i| | +------------+---------------------+--------------+---------------+ | JavaScript | Node 12+ | 2 / |total| | |JavaScript| | +------------+---------------------+--------------+---------------+ diff --git a/docs/c/bcd.rst b/docs/c/bcd.rst index 2b5a7b8a..616faed7 100644 --- a/docs/c/bcd.rst +++ b/docs/c/bcd.rst @@ -40,7 +40,7 @@ It was also a good exercise in x86 assembly, as several portions are accellerate .. c:function:: BCD_int BCD_from_bytes(const unsigned char *str, size_t chars, bool negative, bool little_endian) - Takes in an arbitrary-sized encoded integer (like in Python's :external:python:ref:`int.from_bytes`) to a + Takes in an arbitrary-sized encoded integer (like in Python's :external:py:meth:`int.from_bytes`) to a :c:type:`BCD_int`. .. c:function:: BCD_int BCD_from_ascii(const char *str, size_t digits, bool negative) diff --git a/docs/c/digits.rst b/docs/c/digits.rst index bb0693ef..77e95574 100644 --- a/docs/c/digits.rst +++ b/docs/c/digits.rst @@ -8,7 +8,7 @@ digits.h Implements the :c:macro:`Iterator ` API and yields successive decimal digits of a given number. - .. c:member:: unsigned char (*iterator_function)(*digit_counter) + .. c:member:: unsigned char (*iterator_function)(digit_counter *dc) The function to advance the iterator and return the next element. @@ -32,8 +32,8 @@ digits.h This represents the current position in :c:member:`digits`. - .. c:function:: digit_counter digits(uintmax_t n) +.. c:function:: digit_counter digits(uintmax_t n) - .. c:function:: void free_digit_counter(digit_counter dc) +.. c:function:: void free_digit_counter(digit_counter dc) .. c:namespace-pop:: diff --git a/docs/c/fibonacci.rst b/docs/c/fibonacci.rst index 3db3649e..4eee4246 100644 --- a/docs/c/fibonacci.rst +++ b/docs/c/fibonacci.rst @@ -1,5 +1,5 @@ fibonacci.h -======== +=========== .. c:namespace-push:: fibonacci @@ -8,7 +8,7 @@ fibonacci.h Implements the :c:macro:`Iterator ` API and yields successive Fibonacci numbers. - .. c:member:: uintmax_t (*iterator_function)(*digit_counter) + .. c:member:: uintmax_t (*iterator_function)(fibonacci *fib) The function to advance the iterator and return the next element. diff --git a/docs/c/iterator.rst b/docs/c/iterator.rst index 894be617..e0fbc808 100644 --- a/docs/c/iterator.rst +++ b/docs/c/iterator.rst @@ -60,7 +60,7 @@ iterator.h This is an example implementation of the :c:macro:`Iterator ` API used in this project. You can construct it using any of the factory functions found below, and it is generally used much like Python's - :external:py:ref:`range` object. + :external:py:class:`range` object. .. c:member:: uintmax_t (*iterator_function)(counter *it) diff --git a/docs/c/macros.rst b/docs/c/macros.rst index 5f6fca6a..4ade0ab9 100644 --- a/docs/c/macros.rst +++ b/docs/c/macros.rst @@ -45,21 +45,21 @@ macros.h These macros implement the ``likely()`` and ``unlikely()`` flags, as in the Linux kernel to assist in branch prediction. On ``tcc`` and ``cl`` it has no effect. -.. c:macro:: MAX_FACTORIAL_64 20 - MAX_FACTORIAL_128 34 +.. c:macro:: MAX_FACTORIAL_64 + MAX_FACTORIAL_128 -.. c:macro:: PCC_SQRT_ACCURACY 8 +.. c:macro:: PCC_SQRT_ACCURACY -.. c:macro:: MAX_POW_10_16 10000U - POW_OF_MAX_POW_10_16 4 +.. c:macro:: MAX_POW_10_16 + POW_OF_MAX_POW_10_16 -.. c:macro:: MAX_POW_10_32 1000000000UL - POW_OF_MAX_POW_10_32 9 +.. c:macro:: MAX_POW_10_32 + POW_OF_MAX_POW_10_32 -.. c:macro:: MAX_POW_10_64 10000000000000000000ULL - POW_OF_MAX_POW_10_64 19 +.. c:macro:: MAX_POW_10_64 + POW_OF_MAX_POW_10_64 -.. c:macro:: MAX_POW_10_128 ((uintmax_t) MAX_POW_10_64 * (uintmax_t) MAX_POW_10_64) - POW_OF_MAX_POW_10_128 38 +.. c:macro:: MAX_POW_10_128 + POW_OF_MAX_POW_10_128 .. c:namespace-pop:: diff --git a/docs/c/primes.rst b/docs/c/primes.rst index e313b37f..24342f73 100644 --- a/docs/c/primes.rst +++ b/docs/c/primes.rst @@ -8,7 +8,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime numbers. - .. c:member:: uintmax_t (*iterator_function)(*prime_counter pc) + .. c:member:: uintmax_t (*iterator_function)(prime_counter *pc) The function to advance the iterator and return the next element. @@ -43,7 +43,7 @@ primes.h An :c:macro:`Iterator ` that implements a modified sieve of eratosthenes - .. c:member:: uintmax_t (*iterator_function)(*prime_sieve ps) + .. c:member:: uintmax_t (*iterator_function)(prime_sieve *ps) The function to advance the iterator and return the next element. @@ -92,7 +92,7 @@ primes.h Implements the :c:macro:`Iterator ` API and yields successive prime factors. - .. c:member:: uintmax_t (*iterator_function)(*prime_factor_counter pfc) + .. c:member:: uintmax_t (*iterator_function)(prime_factor_counter *pfc) The function to advance the iterator and return the next element. diff --git a/docs/csharp.rst b/docs/csharp.rst index dd7db365..ea5ee9f3 100644 --- a/docs/csharp.rst +++ b/docs/csharp.rst @@ -14,8 +14,8 @@ Usage .. highlight:: make -This folder contains a Makefile with several recipes> -This facilitates the root Makefile dispatching tasks> +This folder contains a Makefile with several recipes, most of which are aliases to ``dotnet`` commands. +This facilitates the root Makefile dispatching tasks to each language, many of which have more complex build or test processes. .. make:target:: test @@ -28,7 +28,7 @@ build or test processes. WIP - Runs tests in parallel with one less thread than you have CPUs. Alias for ``dotnet test ``. + Runs tests in parallel with one less thread than you have CPUs. Alias for ``dotnet test``. .. make:target:: test_% @@ -36,7 +36,7 @@ build or test processes. WIP - Runs tests in parallel with the specified number of threads. Alias for ``dotnet test `. + Runs tests in parallel with the specified number of threads. Alias for ``dotnet test``. .. make:target:: clean diff --git a/docs/index.rst b/docs/index.rst index 6f5e5877..c9e3b11f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -81,155 +81,172 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` -+-------------+-----+------+------+------+------+ -| |**C**|**C#**|**Js**|**Py**|**Rs**| -+=============+=====+======+======+======+======+ -| Coverage | ✔ | ⏱ | ✔ | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| Docs | ⏱ | ✔ | ✔ | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| Linting | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`1` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`2` | ✔ | ✔ | ✔ | ✔ | ✔ | -+-------------+-----+------+------+------+------+ -| :prob:`3` | ✔ | | | ✔ | ⏱ | -+-------------+-----+------+------+------+------+ -| :prob:`4` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`5` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`6` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`7` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`8` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`9` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`10` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`11` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`12` | ⏱ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`13` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`14` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`15` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`16` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`17` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`18` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`19` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`20` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`21` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`22` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`23` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`24` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`25` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`27` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`29` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`30` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`31` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`32` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`33` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`34` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`35` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`36` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`37` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`38` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`39` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`40` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`41` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`42` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`43` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`44` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`45` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`46` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`47` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`48` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`49` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`50` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`52` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`53` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`55` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`56` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`57` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`59` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`67` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`69` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`71` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`73` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`74` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`76` | ✔ | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`77` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`87` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`92` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`97` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`118` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`123` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`134` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`145` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`187` | | | | ✔ | | -+-------------+-----+------+------+------+------+ -| :prob:`206` | | | | ✔ | | -+-------------+-----+------+------+------+------+ +.. |C| replace:: **C** +.. |C#| replace:: **C#** +.. |Js| replace:: **JavaScript** +.. |Py| replace:: **Python** +.. |Rs| replace:: **Rust** +.. |d| replace:: ✔ +.. |ip| replace:: ⏱ +.. raw:: html + + + ++-----------+------+------+------+------+------+ +| | |C| | |C#| | |Js| | |Py| | |Rs| | ++===========+======+======+======+======+======+ +|Coverage | |d| | |ip| | |d| | |d| | |ip| | ++-----------+------+------+------+------+------+ +|Docs | |ip| | |d| | |d| | |d| | |ip| | ++-----------+------+------+------+------+------+ +|Linting | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|Testing | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ ++-----------+------+------+------+------+------+ +|:prob:`1` | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|:prob:`2` | |d| | |d| | |d| | |d| | |d| | ++-----------+------+------+------+------+------+ +|:prob:`3` | |d| | | | |d| | |ip| | ++-----------+------+------+------+------+------+ +|:prob:`4` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`5` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`6` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`7` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`8` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`9` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`10` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`11` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`12` | |ip| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`13` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`14` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`15` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`16` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`17` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`18` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`19` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`20` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`21` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`22` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`23` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`24` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`25` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`27` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`29` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`30` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`31` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`32` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`33` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`34` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`35` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`36` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`37` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`38` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`39` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`40` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`41` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`42` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`43` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`44` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`45` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`46` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`47` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`48` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`49` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`50` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`52` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`53` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`55` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`56` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`57` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`59` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`67` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`69` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`71` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`73` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`74` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`76` | |d| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`77` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`87` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`92` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`97` | | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`118`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`123`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`134`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`145`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`187`| | | | |d| | | ++-----------+------+------+------+------+------+ +|:prob:`206`| | | | |d| | | ++-----------+------+------+------+------+------+ .. toctree:: :maxdepth: 2 diff --git a/docs/rust/p0001.rst b/docs/rust/p0001.rst index c89e8463..dc932954 100644 --- a/docs/rust/p0001.rst +++ b/docs/rust/p0001.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 1 View source code `here on GitHub! `_ -.. rust:fn:: p0001::p0001() -> int64 +.. rust:fn:: p0001::p0001() -> u64 .. literalinclude:: ../../rust/src/p0001.rs :language: rust diff --git a/docs/rust/p0002.rst b/docs/rust/p0002.rst index f2bc522b..a39ca29b 100644 --- a/docs/rust/p0002.rst +++ b/docs/rust/p0002.rst @@ -3,7 +3,7 @@ Rust Implementation of Problem 2 View source code `here on GitHub! `_ -.. rust:fn:: p0002::p0002() -> int64 +.. rust:fn:: p0002::p0002() -> u64 .. literalinclude:: ../../rust/src/p0002.rs :language: rust