Skip to content

Commit c4e149c

Browse files
committed
feat: add gr type declarations
1 parent d4a8f7c commit c4e149c

File tree

3 files changed

+79
-9
lines changed

3 files changed

+79
-9
lines changed

bin/all_rst_to_pxd.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ modules=(
1515
"mpoly"
1616
# "thread_pool"
1717
# "machine_vectors"
18-
# "gr"
19-
# "gr_domains"
20-
# "gr_generic"
21-
# "gr_implementing"
22-
# "gr_mat"
23-
# "gr_mpoly"
24-
# "gr_poly"
25-
# "gr_special"
26-
# "gr_vec"
18+
"gr"
19+
"gr_domains"
20+
"gr_generic"
21+
"gr_implementing"
22+
"gr_mat"
23+
"gr_mpoly"
24+
"gr_poly"
25+
"gr_special"
26+
"gr_vec"
2727
"ulong_extras"
2828
"fmpz"
2929
# "fmpz_extras"

bin/rst_to_pxd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ def get_all_types(function_list):
144144

145145

146146
def has_types(line, types):
147+
#ts = set(t for t in get_parameter_types(line) if t in types)
148+
#if ts:
149+
# print(ts, file=sys.stderr)
147150
return any(t in types for t in get_parameter_types(line))
148151

149152

src/flint/flintlib/types/gr.pxd

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
cdef extern from "flint/gr.h":
2+
3+
cdef enum truth_t_enum:
4+
T_TRUE
5+
T_FALSE
6+
T_UNKOWN
7+
8+
ctypedef truth_t_enum truth_t
9+
10+
ctypedef struct gr_stream_struct:
11+
FLINT_FILE * fp
12+
char * s
13+
slong len
14+
slong alloc
15+
16+
ctypedef gr_stream_struct gr_stream_t[1]
17+
18+
ctypedef int (*gr_funcptr)(void)
19+
20+
cdef const int GR_CTX_STRUCT_DATA_BYTES
21+
22+
ctypedef int (*gr_funcptr)(void)
23+
24+
cdef struct gr_ctx_struct:
25+
char data[GR_CTX_STRUCT_DATA_BYTES]
26+
ulong which_ring
27+
slong sizeof_elem
28+
gr_funcptr * methods
29+
ulong size_limit
30+
31+
ctypedef gr_ctx_struct gr_ctx_t[1]
32+
33+
ctypedef void * gr_ptr
34+
ctypedef const void * gr_srcptr
35+
ctypedef void * gr_ctx_ptr
36+
37+
ctypedef struct gr_vec_struct:
38+
gr_ptr entries
39+
slong alloc
40+
slong length
41+
42+
ctypedef gr_vec_struct gr_vec_t[1]
43+
44+
ctypedef struct gr_mat_struct:
45+
gr_ptr entries
46+
slong r
47+
slong c
48+
gr_ptr * rows
49+
50+
ctypedef gr_mat_struct gr_mat_t[1]
51+
52+
ctypedef struct gr_poly_struct:
53+
gr_ptr coeffs
54+
slong alloc
55+
slong length
56+
57+
ctypedef gr_poly_struct gr_poly_t[1]
58+
59+
ctypedef struct gr_mpoly_struct:
60+
gr_ptr coeffs
61+
ulong * exps
62+
slong length
63+
flint_bitcnt_t bits # number of bits per exponent
64+
slong coeffs_alloc # abs size in ulong units
65+
slong exps_alloc # abs size in ulong units
66+
67+
ctypedef gr_mpoly_struct gr_mpoly_t[1]

0 commit comments

Comments
 (0)