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

Improvement to flint_autogen reader #39530

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 7 additions & 2 deletions src/sage_setup/autogen/flint/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,16 @@ def process_line(self):
line = self.lines[self.i]
if line.startswith('.. function::'):
self.add_declaration()
if line[13] != ' ':
line_rest = line.removeprefix('.. function::')
if not line_rest.startswith(' '):
print('Warning: no space {}'.format(line))
self.signatures.append(line[13:].strip())
self.state = self.FUNCTION_DECLARATION
self.i += 1
signature = line_rest.strip()
while signature.endswith('\\'):
signature = signature.removesuffix('\\').strip() + ' ' + self.lines[self.i].strip()
self.i += 1
self.signatures.append(signature)
elif line.startswith('.. macro::'):
self.add_declaration()
if line[10] != ' ':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Import this module::

sage: import sage.libs.flint.flint_sage

We verify that :trac:`6919` is correctly fixed::
We verify that :issue:`6919` is correctly fixed::

sage: R.<x> = PolynomialRing(ZZ)
sage: A = 2^(2^17+2^15)
Expand Down
13 changes: 13 additions & 0 deletions src/sage_setup/autogen/flint/templates/types.pxd.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ctypedef mp_limb_t ulong
ctypedef mp_limb_signed_t slong
ctypedef mp_limb_t flint_bitcnt_t

# New in flint 3.2.0-rc1
ctypedef mp_ptr nn_ptr
ctypedef mp_srcptr nn_srcptr

cdef extern from "flint_wrap.h":
# flint/fmpz.h
Expand Down Expand Up @@ -269,6 +272,16 @@ cdef extern from "flint_wrap.h":
ctypedef struct flint_rand_s:
pass
ctypedef flint_rand_s flint_rand_t[1]
ctypedef enum flint_err_t:
# flint_autogen.py does not support parsing .. enum:: yet
FLINT_ERROR
FLINT_OVERFLOW
FLINT_IMPINV
FLINT_DOMERR
FLINT_DIVZERO
FLINT_EXPOF
FLINT_INEXACT
FLINT_TEST_FAIL

cdef long FLINT_BITS
cdef long FLINT_D_BITS
Expand Down
Loading