1 /*
2     Copyright (C) 2011 Sebastian Pancratz
3     Copyright (C) 2013 Mike Hansen
4 
5     This file is part of FLINT.
6 
7     FLINT is free software: you can redistribute it and/or modify it under
8     the terms of the GNU Lesser General Public License (LGPL) as published
9     by the Free Software Foundation; either version 2.1 of the License, or
10     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
11 */
12 
13 #ifdef T
14 
15 #include "templates.h"
16 
17 #include <stdio.h>
18 #include <gmp.h>
19 #include "fmpz.h"
20 int
_TEMPLATE(T,poly_fprint)21 _TEMPLATE(T, poly_fprint) (FILE * file, const TEMPLATE(T, struct) * poly,
22                            slong len, const TEMPLATE(T, ctx_t) ctx)
23 {
24     int r;
25     slong i;
26 
27     r = flint_fprintf(file, "%wd ", len);
28     if (r <= 0)
29         return r;
30 
31     if (len == 0)
32         return r;
33 
34     for (i = 0; (r > 0) && (i < len); i++)
35     {
36         r = flint_fprintf(file, " ");
37         if (r <= 0)
38             return r;
39         r = TEMPLATE(T, fprint) (file, poly + i, ctx);
40         if (r <= 0)
41             return r;
42     }
43 
44     return r;
45 }
46 
47 int
TEMPLATE(T,poly_fprint)48 TEMPLATE(T, poly_fprint) (FILE * file, const TEMPLATE(T, poly_t) poly,
49                           const TEMPLATE(T, ctx_t) ctx)
50 {
51     return _TEMPLATE(T, poly_fprint) (file, poly->coeffs, poly->length, ctx);
52 }
53 
54 
55 #endif
56