Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macros for documentation #2216

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More macros
  • Loading branch information
albinahlback committed Jan 29, 2025
commit 81457f0b0e37d95f9eb51005244f89e03a503400
16 changes: 8 additions & 8 deletions doc/source/fmpz.rst.pp
Original file line number Diff line number Diff line change
Expand Up @@ -769,17 +769,17 @@ functions such an object first has to be initialised with a call to

Sets `f_1` to the absolute value of `f_2`.

.. function:: void fmpz_add(fmpz_t f, const fmpz_t g, const fmpz_t h)
void fmpz_add_ui(fmpz_t f, const fmpz_t g, ulong h)
void fmpz_add_si(fmpz_t f, const fmpz_t g, slong h)
func_add(fmpz)
func_add_si(fmpz)
func_add_ui(fmpz)

Sets `f` to `g + h`.
desc_add()

.. function:: void fmpz_sub(fmpz_t f, const fmpz_t g, const fmpz_t h)
void fmpz_sub_ui(fmpz_t f, const fmpz_t g, ulong h)
void fmpz_sub_si(fmpz_t f, const fmpz_t g, slong h)
func_sub(fmpz)
func_sub_si(fmpz)
func_sub_ui(fmpz)

Sets `f` to `g - h`.
desc_sub()

.. function:: void fmpz_mul(fmpz_t f, const fmpz_t g, const fmpz_t h)
void fmpz_mul_ui(fmpz_t f, const fmpz_t g, ulong h)
Expand Down
53 changes: 42 additions & 11 deletions doc/source/macros.m4
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
dnl Define stuff here
define(`__function_prefix',`.. function::')dnl
dnl
define(`addition',dnl
m4_assert_numargs(1)dnl
`__function_prefix $1_add($1_t r, $1_t a, $1_t b)

poopy doopy'dnl
)dnl
dnl
dnl Change quotes to something that is not used anywhere
changequote({{{,}}})dnl
changequote({{{{,}}}})dnl
dnl
dnl############################################################################
dnl function prefix
dnl############################################################################
define({{{__function_prefix}}},{{{.. function::}}})dnl
dnl############################################################################
dnl addition
dnl############################################################################
define({{{func_add}}},dnl
{{{__function_prefix dnl
void $1_add($1_t r, const $1_t a, const $1_t b)dnl
}}})dnl
define({{{func_add_si}}},dnl
{{{__function_prefix dnl
void $1_add_si($1_t r, const $1_t a, slong b)dnl
}}})dnl
define({{{func_add_ui}}},dnl
{{{__function_prefix dnl
void $1_add_ui($1_t r, const $1_t a, ulong b)dnl
}}})dnl
define({{{desc_add}}},{{{dnl
Sets `r` to `a + b`.dnl
}}})dnl
dnl############################################################################
dnl subtraction
dnl############################################################################
define({{{func_sub}}},dnl
{{{__function_prefix dnl
void $1_sub($1_t r, const $1_t a, const $1_t b)dnl
}}})dnl
define({{{func_sub_si}}},dnl
{{{__function_prefix dnl
void $1_sub_si($1_t r, const $1_t a, slong b)dnl
}}})dnl
define({{{func_sub_ui}}},dnl
{{{__function_prefix dnl
void $1_sub_ui($1_t r, const $1_t a, ulong b)dnl
}}})dnl
define({{{desc_sub}}},{{{dnl
Sets `r` to `a - b`.dnl
}}})dnl