flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
448 stars 245 forks source link

Macro declarations #1529

Open videlec opened 1 year ago

videlec commented 1 year ago

When parsing .rst files to produce Cython .pxd files (as in https://github.com/sagemath/sage/pull/36449) I would like to also be able to parse macros. However, Cython is completely agnostic to macros that must be defined as functions. Would it be fine to do changes in the flint doc such as

diff --git a/doc/source/acb_mat.rst b/doc/source/acb_mat.rst
index 5d18fd0f3..3240d0260 100644
--- a/doc/source/acb_mat.rst
+++ b/doc/source/acb_mat.rst
@@ -38,15 +38,15 @@ Types, macros and constants
     *acb_mat_struct*, permitting an *acb_mat_t* to
     be passed by reference.

-.. macro:: acb_mat_entry(mat, i, j)
+.. macro:: acb_ptr acb_mat_entry(acb_mat_t mat, slong i, slong j)

     Macro giving a pointer to the entry at row *i* and column *j*.

-.. macro:: acb_mat_nrows(mat)
+.. macro:: slong acb_mat_nrows(acb_mat_t mat)

     Returns the number of rows of the matrix.

-.. macro:: acb_mat_ncols(mat)
+.. macro:: slong acb_mat_ncols(acb_mat_t mat)

     Returns the number of columns of the matrix.

(where appropriate)

albinahlback commented 1 month ago

If such a change is only for type specific macros, I have no problem with this. However, macros like FLINT_MAX are not type specific.

albinahlback commented 1 month ago

I suppose Cython would not be able to handle what I proposed in #1985, right?