1use crate::deps::*;
4use crate::arf_types::*;
5use crate::flint::*;
6use crate::fmpz_types::*;
7use crate::gr_types::*;
8use crate::mpoly_types::*;
9
10
11pub const FEXPR_TYPE_BITS: u32 = 4;
12pub const FEXPR_SMALL_SYMBOL_LEN: u32 = 7;
13pub const FEXPR_LATEX_SMALL: u32 = 1;
14pub const FEXPR_LATEX_LOGIC: u32 = 2;
15#[repr(C)]
16pub struct fexpr_struct {
17 pub data: *mut ulong,
18 pub alloc: slong,
19}
20#[allow(clippy::unnecessary_operation, clippy::identity_op)]
21const _: () = {
22 ["Size of fexpr_struct"][::std::mem::size_of::<fexpr_struct>() - 16usize];
23 ["Alignment of fexpr_struct"][::std::mem::align_of::<fexpr_struct>() - 8usize];
24 ["Offset of field: fexpr_struct::data"][::std::mem::offset_of!(fexpr_struct, data) - 0usize];
25 ["Offset of field: fexpr_struct::alloc"][::std::mem::offset_of!(fexpr_struct, alloc) - 8usize];
26};
27impl Default for fexpr_struct {
28 fn default() -> Self {
29 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
30 unsafe {
31 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
32 s.assume_init()
33 }
34 }
35}
36pub type fexpr_t = [fexpr_struct; 1usize];
37pub type fexpr_ptr = *mut fexpr_struct;
38pub type fexpr_srcptr = *const fexpr_struct;
39#[repr(C)]
40pub struct fexpr_vec_struct {
41 pub entries: *mut fexpr_struct,
42 pub alloc: slong,
43 pub length: slong,
44}
45#[allow(clippy::unnecessary_operation, clippy::identity_op)]
46const _: () = {
47 ["Size of fexpr_vec_struct"][::std::mem::size_of::<fexpr_vec_struct>() - 24usize];
48 ["Alignment of fexpr_vec_struct"][::std::mem::align_of::<fexpr_vec_struct>() - 8usize];
49 ["Offset of field: fexpr_vec_struct::entries"]
50 [::std::mem::offset_of!(fexpr_vec_struct, entries) - 0usize];
51 ["Offset of field: fexpr_vec_struct::alloc"]
52 [::std::mem::offset_of!(fexpr_vec_struct, alloc) - 8usize];
53 ["Offset of field: fexpr_vec_struct::length"]
54 [::std::mem::offset_of!(fexpr_vec_struct, length) - 16usize];
55};
56impl Default for fexpr_vec_struct {
57 fn default() -> Self {
58 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
59 unsafe {
60 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
61 s.assume_init()
62 }
63 }
64}
65pub type fexpr_vec_t = [fexpr_vec_struct; 1usize];
66extern "C" {
67 #[link_name = "fexpr_init__extern"]
68 pub fn fexpr_init(expr: *mut fexpr_struct);
69 #[link_name = "fexpr_clear__extern"]
70 pub fn fexpr_clear(expr: *mut fexpr_struct);
71 #[link_name = "_fexpr_vec_init__extern"]
72 pub fn _fexpr_vec_init(len: slong) -> fexpr_ptr;
73 #[link_name = "_fexpr_vec_clear__extern"]
74 pub fn _fexpr_vec_clear(vec: fexpr_ptr, len: slong);
75 #[link_name = "fexpr_fit_size__extern"]
76 pub fn fexpr_fit_size(expr: *mut fexpr_struct, size: slong);
77 #[link_name = "_fexpr_size__extern"]
78 pub fn _fexpr_size(expr: *const ulong) -> slong;
79 #[link_name = "fexpr_size__extern"]
80 pub fn fexpr_size(expr: *const fexpr_struct) -> slong;
81 #[link_name = "fexpr_set__extern"]
82 pub fn fexpr_set(res: *mut fexpr_struct, expr: *const fexpr_struct);
83 #[link_name = "fexpr_swap__extern"]
84 pub fn fexpr_swap(a: *mut fexpr_struct, b: *mut fexpr_struct);
85 #[link_name = "fexpr_equal__extern"]
86 pub fn fexpr_equal(a: *const fexpr_struct, b: *const fexpr_struct) -> libc::c_int;
87 pub fn fexpr_equal_si(expr: *const fexpr_struct, c: slong) -> libc::c_int;
88 pub fn fexpr_equal_ui(expr: *const fexpr_struct, c: ulong) -> libc::c_int;
89 pub fn fexpr_hash(expr: *const fexpr_struct) -> ulong;
90 pub fn fexpr_cmp_fast(a: *const fexpr_struct, b: *const fexpr_struct) -> libc::c_int;
91 pub fn _fexpr_vec_sort_fast(vec: fexpr_ptr, len: slong);
92 #[link_name = "_fexpr_is_integer__extern"]
93 pub fn _fexpr_is_integer(expr: *const ulong) -> libc::c_int;
94 #[link_name = "fexpr_is_integer__extern"]
95 pub fn fexpr_is_integer(expr: *const fexpr_struct) -> libc::c_int;
96 pub fn fexpr_is_neg_integer(expr: *const fexpr_struct) -> libc::c_int;
97 #[link_name = "_fexpr_is_symbol__extern"]
98 pub fn _fexpr_is_symbol(expr: *const ulong) -> libc::c_int;
99 #[link_name = "fexpr_is_symbol__extern"]
100 pub fn fexpr_is_symbol(expr: *const fexpr_struct) -> libc::c_int;
101 #[link_name = "_fexpr_is_string__extern"]
102 pub fn _fexpr_is_string(expr: *const ulong) -> libc::c_int;
103 #[link_name = "fexpr_is_string__extern"]
104 pub fn fexpr_is_string(expr: *const fexpr_struct) -> libc::c_int;
105 #[link_name = "_fexpr_is_atom__extern"]
106 pub fn _fexpr_is_atom(expr: *const ulong) -> libc::c_int;
107 #[link_name = "fexpr_is_atom__extern"]
108 pub fn fexpr_is_atom(expr: *const fexpr_struct) -> libc::c_int;
109 #[link_name = "fexpr_zero__extern"]
110 pub fn fexpr_zero(res: *mut fexpr_struct);
111 #[link_name = "fexpr_is_zero__extern"]
112 pub fn fexpr_is_zero(expr: *const fexpr_struct) -> libc::c_int;
113 pub fn fexpr_set_si(res: *mut fexpr_struct, c: slong);
114 pub fn fexpr_set_ui(res: *mut fexpr_struct, c: ulong);
115 pub fn fexpr_set_fmpz(res: *mut fexpr_struct, c: *const fmpz);
116 pub fn fexpr_get_fmpz(c: *mut fmpz, x: *const fexpr_struct) -> libc::c_int;
117 pub fn fexpr_set_fmpq(res: *mut fexpr_struct, x: *const fmpq);
118 #[link_name = "fexpr_set_symbol_builtin__extern"]
119 pub fn fexpr_set_symbol_builtin(res: *mut fexpr_struct, id: slong);
120 pub fn fexpr_set_symbol_str(res: *mut fexpr_struct, s: *const libc::c_char);
121 pub fn fexpr_set_string(res: *mut fexpr_struct, s: *const libc::c_char);
122 pub fn fexpr_get_symbol_str(expr: *const fexpr_struct) -> *mut libc::c_char;
123 pub fn fexpr_get_string(expr: *const fexpr_struct) -> *mut libc::c_char;
124 pub fn fexpr_get_decimal_str(
125 expr: *const fexpr_struct,
126 digits: slong,
127 flags: ulong,
128 ) -> *mut libc::c_char;
129 pub fn fexpr_depth(expr: *const fexpr_struct) -> slong;
130 pub fn fexpr_num_leaves(expr: *const fexpr_struct) -> slong;
131 #[link_name = "fexpr_size_bytes__extern"]
132 pub fn fexpr_size_bytes(expr: *const fexpr_struct) -> slong;
133 #[link_name = "fexpr_allocated_bytes__extern"]
134 pub fn fexpr_allocated_bytes(expr: *const fexpr_struct) -> slong;
135 #[link_name = "fexpr_is_any_builtin_symbol__extern"]
136 pub fn fexpr_is_any_builtin_symbol(expr: *const fexpr_struct) -> libc::c_int;
137 #[link_name = "fexpr_is_builtin_symbol__extern"]
138 pub fn fexpr_is_builtin_symbol(expr: *const fexpr_struct, i: slong) -> libc::c_int;
139 pub fn fexpr_is_builtin_call(expr: *const fexpr_struct, i: slong) -> libc::c_int;
140 pub fn fexpr_is_any_builtin_call(expr: *const fexpr_struct) -> libc::c_int;
141 #[link_name = "fexpr_nargs__extern"]
142 pub fn fexpr_nargs(expr: *const fexpr_struct) -> slong;
143 pub fn fexpr_func(res: *mut fexpr_struct, expr: *const fexpr_struct);
144 pub fn fexpr_view_func(res: *mut fexpr_struct, expr: *const fexpr_struct);
145 pub fn fexpr_arg(res: *mut fexpr_struct, expr: *const fexpr_struct, i: slong);
146 pub fn fexpr_view_arg(res: *mut fexpr_struct, expr: *const fexpr_struct, i: slong);
147 #[link_name = "fexpr_view_next__extern"]
148 pub fn fexpr_view_next(view: *mut fexpr_struct);
149 pub fn fexpr_call0(res: *mut fexpr_struct, f: *const fexpr_struct);
150 pub fn fexpr_call1(res: *mut fexpr_struct, f: *const fexpr_struct, x1: *const fexpr_struct);
151 pub fn fexpr_call2(
152 res: *mut fexpr_struct,
153 f: *const fexpr_struct,
154 x1: *const fexpr_struct,
155 x2: *const fexpr_struct,
156 );
157 pub fn fexpr_call3(
158 res: *mut fexpr_struct,
159 f: *const fexpr_struct,
160 x1: *const fexpr_struct,
161 x2: *const fexpr_struct,
162 x3: *const fexpr_struct,
163 );
164 pub fn fexpr_call4(
165 res: *mut fexpr_struct,
166 f: *const fexpr_struct,
167 x1: *const fexpr_struct,
168 x2: *const fexpr_struct,
169 x3: *const fexpr_struct,
170 x4: *const fexpr_struct,
171 );
172 pub fn fexpr_call_vec(
173 res: *mut fexpr_struct,
174 f: *const fexpr_struct,
175 args: fexpr_srcptr,
176 len: slong,
177 );
178 pub fn fexpr_call_builtin1(res: *mut fexpr_struct, f: slong, x: *const fexpr_struct);
179 pub fn fexpr_call_builtin2(
180 res: *mut fexpr_struct,
181 f: slong,
182 x: *const fexpr_struct,
183 y: *const fexpr_struct,
184 );
185 pub fn fexpr_contains(expr: *const fexpr_struct, x: *const fexpr_struct) -> libc::c_int;
186 pub fn fexpr_replace(
187 res: *mut fexpr_struct,
188 expr: *const fexpr_struct,
189 x: *const fexpr_struct,
190 y: *const fexpr_struct,
191 ) -> libc::c_int;
192 pub fn fexpr_replace2(
193 res: *mut fexpr_struct,
194 expr: *const fexpr_struct,
195 x1: *const fexpr_struct,
196 y1: *const fexpr_struct,
197 x2: *const fexpr_struct,
198 y2: *const fexpr_struct,
199 ) -> libc::c_int;
200 pub fn fexpr_replace_vec(
201 res: *mut fexpr_struct,
202 expr: *const fexpr_struct,
203 xs: *const fexpr_vec_struct,
204 ys: *const fexpr_vec_struct,
205 ) -> libc::c_int;
206 pub fn fexpr_write(stream: *mut gr_stream_struct, expr: *const fexpr_struct);
207 pub fn fexpr_print(expr: *const fexpr_struct);
208 pub fn fexpr_get_str(expr: *const fexpr_struct) -> *mut libc::c_char;
209 pub fn fexpr_write_latex(out: *mut gr_stream_struct, expr: *const fexpr_struct, flags: ulong);
210 pub fn fexpr_print_latex(expr: *const fexpr_struct, flags: ulong);
211 pub fn fexpr_get_str_latex(expr: *const fexpr_struct, flags: ulong) -> *mut libc::c_char;
212 pub fn fexpr_write_latex_call(
213 out: *mut gr_stream_struct,
214 expr: *const fexpr_struct,
215 flags: ulong,
216 );
217 pub fn fexpr_write_latex_subscript(
218 out: *mut gr_stream_struct,
219 expr: *const fexpr_struct,
220 flags: ulong,
221 );
222 pub fn fexpr_write_latex_subscript_call(
223 out: *mut gr_stream_struct,
224 expr: *const fexpr_struct,
225 flags: ulong,
226 );
227 pub fn fexpr_write_latex_infix(
228 out: *mut gr_stream_struct,
229 expr: *const fexpr_struct,
230 flags: ulong,
231 );
232 pub fn fexpr_write_latex_mul(
233 out: *mut gr_stream_struct,
234 expr: *const fexpr_struct,
235 flags: ulong,
236 );
237 pub fn fexpr_write_latex_div(
238 out: *mut gr_stream_struct,
239 expr: *const fexpr_struct,
240 flags: ulong,
241 );
242 pub fn fexpr_write_latex_neg_pos(
243 out: *mut gr_stream_struct,
244 expr: *const fexpr_struct,
245 flags: ulong,
246 );
247 pub fn fexpr_write_latex_add(
248 out: *mut gr_stream_struct,
249 expr: *const fexpr_struct,
250 flags: ulong,
251 );
252 pub fn fexpr_write_latex_sub(
253 out: *mut gr_stream_struct,
254 expr: *const fexpr_struct,
255 flags: ulong,
256 );
257 pub fn fexpr_write_latex_pow(
258 out: *mut gr_stream_struct,
259 expr: *const fexpr_struct,
260 flags: ulong,
261 );
262 pub fn fexpr_write_latex_exp(
263 out: *mut gr_stream_struct,
264 expr: *const fexpr_struct,
265 flags: ulong,
266 );
267 pub fn fexpr_write_latex_factorial(
268 out: *mut gr_stream_struct,
269 expr: *const fexpr_struct,
270 flags: ulong,
271 );
272 pub fn fexpr_write_latex_integral(
273 out: *mut gr_stream_struct,
274 expr: *const fexpr_struct,
275 flags: ulong,
276 );
277 pub fn fexpr_write_latex_sum_product(
278 out: *mut gr_stream_struct,
279 expr: *const fexpr_struct,
280 flags: ulong,
281 );
282 pub fn fexpr_write_latex_divsum(
283 out: *mut gr_stream_struct,
284 expr: *const fexpr_struct,
285 flags: ulong,
286 );
287 pub fn fexpr_write_latex_limit(
288 out: *mut gr_stream_struct,
289 expr: *const fexpr_struct,
290 flags: ulong,
291 );
292 pub fn fexpr_write_latex_derivative(
293 out: *mut gr_stream_struct,
294 expr: *const fexpr_struct,
295 flags: ulong,
296 );
297 pub fn fexpr_write_latex_logic(
298 out: *mut gr_stream_struct,
299 expr: *const fexpr_struct,
300 flags: ulong,
301 );
302 pub fn fexpr_write_latex_collection(
303 out: *mut gr_stream_struct,
304 expr: *const fexpr_struct,
305 flags: ulong,
306 );
307 pub fn fexpr_write_latex_matrix(
308 out: *mut gr_stream_struct,
309 expr: *const fexpr_struct,
310 flags: ulong,
311 );
312 pub fn fexpr_write_latex_simple(
313 out: *mut gr_stream_struct,
314 expr: *const fexpr_struct,
315 flags: ulong,
316 );
317 pub fn fexpr_write_latex_simple2(
318 out: *mut gr_stream_struct,
319 expr: *const fexpr_struct,
320 flags: ulong,
321 );
322 pub fn fexpr_write_latex_simple2_small(
323 out: *mut gr_stream_struct,
324 expr: *const fexpr_struct,
325 flags: ulong,
326 );
327 pub fn fexpr_write_latex_alg_structure(
328 out: *mut gr_stream_struct,
329 expr: *const fexpr_struct,
330 flags: ulong,
331 );
332 pub fn fexpr_write_latex_setop(
333 out: *mut gr_stream_struct,
334 expr: *const fexpr_struct,
335 flags: ulong,
336 );
337 pub fn fexpr_write_latex_cases(
338 out: *mut gr_stream_struct,
339 expr: *const fexpr_struct,
340 flags: ulong,
341 );
342 pub fn fexpr_write_latex_where(
343 out: *mut gr_stream_struct,
344 expr: *const fexpr_struct,
345 flags: ulong,
346 );
347 pub fn fexpr_write_latex_show_form(
348 out: *mut gr_stream_struct,
349 expr: *const fexpr_struct,
350 flags: ulong,
351 );
352 pub fn fexpr_write_latex_range(
353 out: *mut gr_stream_struct,
354 expr: *const fexpr_struct,
355 flags: ulong,
356 );
357 pub fn fexpr_write_latex_decimal(
358 out: *mut gr_stream_struct,
359 expr: *const fexpr_struct,
360 flags: ulong,
361 );
362 pub fn fexpr_write_latex_call1_optional_derivative(
363 out: *mut gr_stream_struct,
364 expr: *const fexpr_struct,
365 flags: ulong,
366 );
367 pub fn fexpr_write_latex_call2_optional_derivative(
368 out: *mut gr_stream_struct,
369 expr: *const fexpr_struct,
370 flags: ulong,
371 );
372 pub fn fexpr_write_latex_sub1_call1_optional_derivative(
373 out: *mut gr_stream_struct,
374 expr: *const fexpr_struct,
375 flags: ulong,
376 );
377 pub fn fexpr_write_latex_sub1_call2_optional_derivative(
378 out: *mut gr_stream_struct,
379 expr: *const fexpr_struct,
380 flags: ulong,
381 );
382 pub fn fexpr_write_latex_misc_special(
383 out: *mut gr_stream_struct,
384 expr: *const fexpr_struct,
385 flags: ulong,
386 );
387 pub fn fexpr_write_latex_residue(
388 out: *mut gr_stream_struct,
389 expr: *const fexpr_struct,
390 flags: ulong,
391 );
392 pub fn fexpr_set_arf(res: *mut fexpr_struct, x: *const arf_struct);
393 pub fn fexpr_set_d(res: *mut fexpr_struct, x: f64);
394 pub fn fexpr_set_re_im_d(res: *mut fexpr_struct, x: f64, y: f64);
395 pub fn fexpr_neg(res: *mut fexpr_struct, a: *const fexpr_struct);
396 pub fn fexpr_add(res: *mut fexpr_struct, a: *const fexpr_struct, b: *const fexpr_struct);
397 pub fn fexpr_sub(res: *mut fexpr_struct, a: *const fexpr_struct, b: *const fexpr_struct);
398 pub fn fexpr_mul(res: *mut fexpr_struct, a: *const fexpr_struct, b: *const fexpr_struct);
399 pub fn fexpr_div(res: *mut fexpr_struct, a: *const fexpr_struct, b: *const fexpr_struct);
400 pub fn fexpr_pow(res: *mut fexpr_struct, a: *const fexpr_struct, b: *const fexpr_struct);
401 pub fn fexpr_is_arithmetic_operation(expr: *const fexpr_struct) -> libc::c_int;
402 pub fn fexpr_arithmetic_nodes(nodes: *mut fexpr_vec_struct, expr: *const fexpr_struct);
403 pub fn fexpr_get_fmpz_mpoly_q(
404 res: *mut fmpz_mpoly_q_struct,
405 expr: *const fexpr_struct,
406 vars: *const fexpr_vec_struct,
407 ctx: *const fmpz_mpoly_ctx_struct,
408 ) -> libc::c_int;
409 pub fn fexpr_set_fmpz_mpoly(
410 res: *mut fexpr_struct,
411 poly: *const fmpz_mpoly_struct,
412 vars: *const fexpr_vec_struct,
413 ctx: *const fmpz_mpoly_ctx_struct,
414 );
415 pub fn fexpr_set_fmpz_mpoly_q(
416 res: *mut fexpr_struct,
417 frac: *const fmpz_mpoly_q_struct,
418 vars: *const fexpr_vec_struct,
419 ctx: *const fmpz_mpoly_ctx_struct,
420 );
421 pub fn fexpr_expanded_normal_form(
422 res: *mut fexpr_struct,
423 expr: *const fexpr_struct,
424 flags: ulong,
425 ) -> libc::c_int;
426 #[link_name = "fexpr_vec_init__extern"]
427 pub fn fexpr_vec_init(vec: *mut fexpr_vec_struct, len: slong);
428 #[link_name = "fexpr_vec_print__extern"]
429 pub fn fexpr_vec_print(F: *const fexpr_vec_struct);
430 #[link_name = "fexpr_vec_swap__extern"]
431 pub fn fexpr_vec_swap(x: *mut fexpr_vec_struct, y: *mut fexpr_vec_struct);
432 #[link_name = "fexpr_vec_fit_length__extern"]
433 pub fn fexpr_vec_fit_length(vec: *mut fexpr_vec_struct, len: slong);
434 #[link_name = "fexpr_vec_clear__extern"]
435 pub fn fexpr_vec_clear(vec: *mut fexpr_vec_struct);
436 #[link_name = "fexpr_vec_set__extern"]
437 pub fn fexpr_vec_set(dest: *mut fexpr_vec_struct, src: *const fexpr_vec_struct);
438 #[link_name = "fexpr_vec_append__extern"]
439 pub fn fexpr_vec_append(vec: *mut fexpr_vec_struct, f: *const fexpr_struct);
440 #[link_name = "fexpr_vec_insert_unique__extern"]
441 pub fn fexpr_vec_insert_unique(vec: *mut fexpr_vec_struct, f: *const fexpr_struct) -> slong;
442 #[link_name = "fexpr_vec_set_length__extern"]
443 pub fn fexpr_vec_set_length(vec: *mut fexpr_vec_struct, len: slong);
444}