Skip to content

Commit

Permalink
revamp includes sections, squash warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 20, 2024
1 parent 3275e9c commit b37eeb6
Show file tree
Hide file tree
Showing 55 changed files with 171 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ docs/_build
**/dist/*
javascript/src/lib/fallbacks
docs/languages*.svg
docs/_tags
docs/_tags
docs/inv/*/objects.inv
47 changes: 15 additions & 32 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from fnmatch import fnmatch
from os import environ, path, sep, walk
from pathlib import Path
from zlib import compress
from subprocess import check_call
from sys import path as sys_path

Expand Down Expand Up @@ -155,14 +157,20 @@
# -- Options for intersphinx extension ---------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration

for p in Path(__file__).parent.joinpath('inv').glob('*'):
with p.joinpath('inv_raw.txt').open('rb') as f, p.joinpath('objects.inv').open('wb') as g:
g.writelines(f.readline() for _ in range(4))
g.write(compress(f.read()))

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'matplotlib': ('https://matplotlib.org/stable/', None),
'Sphinx': ('https://www.sphinx-doc.org/en/stable/', None),
'sortedcontainers': ('https://grantjenks.com/docs/sortedcontainers/', None),
'u-msgpack-python': ('https://u-msgpack-python.readthedocs.io/en/latest/', None),
'pytest': ('https://docs.pytest.org/en/stable/', None),
'coverage': ('https://coverage.readthedocs.io/en/latest/', None)
'coverage': ('https://coverage.readthedocs.io/en/latest/', None),
'rust': ('', './inv/rust/objects.inv'),
}

# -- Options for todo extension ----------------------------------------------
Expand Down Expand Up @@ -240,14 +248,7 @@ def setup(app):
plt.savefig('languages.svg', transparent=True, bbox_inches='tight')

sizes = [float(size) / count for size, count in zip(sizes, counts)]
triples = sorted(zip(sizes, labels, colors), reverse=True)
sizes = [lang[0] for lang in triples]
labels = [lang[1] for lang in triples]
colors = [lang[2] for lang in triples]
pos = labels.index('Makefile')
labels.pop(pos)
sizes.pop(pos)
colors.pop(pos)
sizes, labels, colors = zip(*sorted(zip(sizes, labels, colors), reverse=True))
_, ax = plt.subplots()
ax.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85)
plt.legend(title='Languages', loc='right', bbox_to_anchor=(1,0.5), bbox_transform=plt.gcf().transFigure)
Expand All @@ -261,28 +262,10 @@ def setup(app):
'rust',
'Rust',
{
'fn': {
},
'enum': {
},
'struct': {
},
'var': {
},
'crate': {
}
'fn': {},
'enum': {},
'struct': {},
'trait': {},
'macro': {},
}
))

# app.add_domain(custom_domain(
# 'JavaDomain',
# 'java',
# 'Java',
# {
# 'class': {
# },
# 'method': {
# },
# }
# ))

21 changes: 21 additions & 0 deletions docs/inv/rust/inv_raw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Sphinx inventory version 2
# Project: Rust Inventory
# Version: 0.0.1
# The remainder of this file is compressed using zlib.
itertools::Itertools rust:trait 1 https://docs.rs/itertools/latest/itertools/trait.Itertools.html itertools::Itertools
num_traits::NumAssign rust:trait 1 https://docs.rs/num-traits/latest/num_traits/trait.NumAssign.html num_traits::NumAssign
num_traits::One rust:trait 1 https://docs.rs/num-traits/latest/num_traits/identities/trait.One.html num_traits::One
num_traits::Zero rust:trait 1 https://docs.rs/num-traits/latest/num_traits/identities/trait.Zero.html num_traits::Zero
num_traits::one rust:fn 1 https://docs.rs/num-traits/latest/num_traits/identities/fn.one.html num_traits::one
num_traits::zero rust:fn 1 https://docs.rs/num-traits/latest/num_traits/identities/fn.zero.html num_traits::zero
std::cmp::max rust:fn 1 https://doc.rust-lang.org/stable/std/cmp/fn.max.html std::cmp::max
std::cmp::Ord rust:trait 1 https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html std::cmp::Ord
std::cmp::PartialOrd rust:trait 1 https://doc.rust-lang.org/stable/std/cmp/trait.PartialOrd.html std::cmp::PartialOrd
std::collections::HashMap rust:struct 1 https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html std::collections::HashMap
std::hash::Hash rust:trait 1 https://doc.rust-lang.org/stable/std/cmp/trait.Hash.html std::hash::Hash
std::mem::size_of rust:fn 1 https://doc.rust-lang.org/stable/std/mem/fn.size_of.html std::mem::size_of
std::ops::Add rust:trait 1 https://doc.rust-lang.org/stable/std/ops/trait.Add.html std::ops::Add
std::ops::Div rust:trait 1 https://doc.rust-lang.org/stable/std/ops/trait.Div.html std::ops::Div
std::ops::Mul rust:trait 1 https://doc.rust-lang.org/stable/std/ops/trait.Mul.html std::ops::Mul
std::ops::Rem rust:trait 1 https://doc.rust-lang.org/stable/std/ops/trait.Rem.html std::ops::Rem
seq_macro::seq rust:macro 1 https://docs.rs/seq-macro/latest/seq_macro/macro.seq.html seq_macro::seq
4 changes: 2 additions & 2 deletions docs/src/c/lib/bcd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ It was also a good exercise in x86 assembly, as several portions are accellerate
.. c:member:: packed_BCD_pair *digits
This array holds the digit-pairs that encode the number. Because of this, you must use :c:ref:`free_bcd` to destroy
This array holds the digit-pairs that encode the number. Because of this, you must use :c:func:`~c.bcd.free_bcd` to destroy
these objects without leaking memory.

.. c:member:: size_t bcd_digits
Expand Down Expand Up @@ -59,7 +59,7 @@ It was also a good exercise in x86 assembly, as several portions are accellerate
.. c:function:: BCD_int BCD_from_ascii(const char *str, size_t digits, bool negative)
From an ASCII-encoded integer to a :c:ref:`BCD_int`.
From an ASCII-encoded integer to a :c:func:`~c.bcd.BCD_int`.
.. c:function:: BCD_int add_bcd(BCD_int x, BCD_int y)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/c/lib/iterator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ Includes
.. c:member:: uintmax_t stop
The point before which the counter will stop (as in :external:py:ref:`range`).
The point before which the counter will stop (as in :external:py:class:`range`).
.. c:member:: intmax_t step
The amount by which the counter will move in each iteration (as in :external:py:ref:`range`).
The amount by which the counter will move in each iteration (as in :external:py:class:`range`).
.. c:function:: uintmax_t iterate_counter(counter *i)
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0001.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0001
.. c:function:: uint32_t p0001()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0002.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0002
.. c:function:: uint32_t p0002()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0003.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0003
.. c:function:: uint16_t p0003()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0004.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0004
.. c:function:: uint32_t p0004()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0005.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0005
.. c:function:: uint32_t p0005()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0006.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0006
.. c:function:: uint32_t p0006()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0007.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0007
.. c:function:: uint32_t p0007()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0008.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0008
.. c:function:: uint64_t p0008()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0009.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0009
.. c:function:: uint32_t p0009()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0010.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0010
.. c:function:: uint64_t p0010()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0011.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0011
.. c:function:: uint64_t p0011()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0012.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0012
.. c:function:: uint64_t p0012()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0013.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0013
.. c:function:: uint64_t p0013()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0014.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0014
.. c:function:: uint64_t p0014()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0015.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0015
.. c:function:: uint64_t p0015()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0016.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0016
.. c:function:: uint64_t p0016()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0017.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0017
.. c:function:: uint64_t p0017()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0019.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0019
.. c:function:: uint16_t p0019()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0020.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0020
.. c:function:: uint64_t p0020()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0022.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0022
.. c:function:: int cmpstr(const void *a, const void *b)
A wrapper around ``strcmp()`` to adapt it for ``qsort()``
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0025.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0025
.. c:function:: uint64_t p0025()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0030.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0030
.. c:function:: uint64_t p0030()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0034.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0034
.. c:function:: uint64_t p0034()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0076.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0076
.. c:function:: uint64_t p0076()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
2 changes: 2 additions & 0 deletions docs/src/c/p0836.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Includes
Solution
--------

.. c:namespace-push:: p0836
.. c:function:: char *p0836()
.. c:function:: int main(int argc, char const *argv[])
Expand Down
8 changes: 4 additions & 4 deletions docs/src/cplusplus/lib/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ Includes
- :cref:`\<stdint.h\> <types/integer>`
- :cref:`\<inttypes.h\> <types/integer>`

.. c:namespace-push:: math
.. cpp:namespace-push:: math
.. c:function:: uintmax_t factorial(uint32_t n)
.. cpp:function:: uintmax_t factorial(uint32_t n)

.. warning::

This function only works for numbers smaller than
:c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAX_FACTORIAL_128`,
depending on the size of ``uintmax_t``.

.. c:function:: uintmax_t n_choose_r(uint32_t n, uint32_t r)
.. cpp:function:: uintmax_t n_choose_r(uint32_t n, uint32_t r)

Returns -1 if there is an overflow. Otherwise returns n choose r.

Expand All @@ -32,7 +32,7 @@ Includes
:c:macro:`MAX_FACTORIAL_64` or :c:macro:`MAX_FACTORIAL_128`,
depending on the size of ``uintmax_t``.

.. c:namespace-pop::
.. cpp:namespace-pop::

.. literalinclude:: ../../../../cplusplus/src/include/math.hpp
:language: C++
Expand Down
Loading

0 comments on commit b37eeb6

Please sign in to comment.