Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

The target is 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
Current view: top level - headers - paripriv.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.10.0 lcov report (development 21203-392a176) Lines: 9 9 100.0 %
Date: 2017-10-23 06:23:29 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright (C) 2004  The PARI group.
       2             : 
       3             : This file is part of the PARI/GP package.
       4             : 
       5             : PARI/GP is free software; you can redistribute it and/or modify it under the
       6             : terms of the GNU General Public License as published by the Free Software
       7             : Foundation. It is distributed in the hope that it will be useful, but WITHOUT
       8             : ANY WARRANTY WHATSOEVER.
       9             : 
      10             : Check the License for details. You should have received a copy of it, along
      11             : with the package; see the file 'COPYING'. If not, write to the Free Software
      12             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      13             : 
      14             : BEGINEXTERN
      15             : 
      16             : /* for qsort */
      17             : typedef int (*QSCOMP)(const void *, const void *);
      18             : 
      19             : #define uel(a,i)            (((ulong*)(a))[i])
      20             : #define ucoeff(a,i,j)       (((ulong**)(a))[j][i])
      21             : #define umael(a,i,j)        (((ulong**)(a))[i][j])
      22             : #define umael2(a,i,j)       (((ulong**)(a))[i][j])
      23             : #define umael3(a,i,j,k)     (((ulong***)(a))[i][j][k])
      24             : #define umael4(a,i,j,k,l)   (((ulong****)(a))[i][j][k][l])
      25             : #define umael5(a,i,j,k,l,m) (((ulong*****)(a))[i][j][k][l][m])
      26             : 
      27             : #define numberof(x) (sizeof(x) / sizeof((x)[0]))
      28             : 
      29             : /* to manipulate 'blocs' */
      30             : #define BL_HEAD 4
      31             : #define bl_base(x) (void*)((x) - BL_HEAD)
      32             : #define bl_refc(x) (((GEN)x)[-4])
      33             : #define bl_next(x) (((GEN*)x)[-3])
      34             : #define bl_prev(x) (((GEN*)x)[-2])
      35             : #define bl_num(x)  (((GEN)x)[-1])
      36             : INLINE void
      37   268450871 : clone_lock(GEN C) { if (isclone(C)) ++bl_refc(C); }
      38             : INLINE void
      39   269007082 : clone_unlock(GEN C) { if (isclone(C)) gunclone(C); }
      40             : 
      41             : /* swap */
      42             : #define lswap(x,y) {long _z=x; x=y; y=_z;}
      43             : #define pswap(x,y) {GEN *_z=x; x=y; y=_z;}
      44             : #define swap(x,y)  {GEN  _z=x; x=y; y=_z;}
      45             : #define dswap(x,y) { double _t=x; x=y; y=_t; }
      46             : #define pdswap(x,y) { double* _t=x; x=y; y=_t; }
      47             : #define swapspec(x,y, nx,ny) {swap(x,y); lswap(nx,ny);}
      48             : 
      49             : /* loops */
      50             : GEN incloop(GEN a);
      51             : GEN resetloop(GEN a, GEN b);
      52             : GEN setloop(GEN a);
      53             : 
      54             : /* parser */
      55             : 
      56             : /* GP control structures */
      57             : #define EXPR_WRAP(code, call) \
      58             : { GEN z; GEN __E = code; \
      59             :   push_lex(gen_0, __E); z = call; pop_lex(1); return z; }
      60             : #define EXPR_ARG __E, &gp_eval
      61             : #define EXPR_ARGPREC __E, &gp_evalprec
      62             : #define EXPR_ARGUPTO __E, &gp_evalupto
      63             : #define EXPR_ARGBOOL __E, &gp_evalbool
      64             : 
      65             : GEN  iferrpari(GEN a, GEN b, GEN c);
      66             : void forfactored(GEN a, GEN b, GEN code);
      67             : void forpari(GEN a, GEN b, GEN node);
      68             : void untilpari(GEN a, GEN b);
      69             : void whilepari(GEN a, GEN b);
      70             : GEN  ifpari(GEN g, GEN a, GEN b);
      71             : GEN  andpari(GEN a, GEN b);
      72             : GEN  orpari(GEN a, GEN b);
      73             : void ifpari_void(GEN g, GEN a, GEN b);
      74             : GEN  ifpari_multi(GEN g, GEN a);
      75             : GEN  geval_gp(GEN x, GEN t);
      76             : 
      77             : GEN  gadde(GEN *x, GEN y);
      78             : GEN  gadd1e(GEN *x);
      79             : GEN  gdive(GEN *x, GEN y);
      80             : GEN  gdivente(GEN *x, GEN y);
      81             : GEN  gdivrounde(GEN *x, GEN y);
      82             : GEN  gmode(GEN *x, GEN y);
      83             : GEN  gmule(GEN *x, GEN y);
      84             : GEN  gshiftle(GEN *x, long n);
      85             : GEN  gshiftre(GEN *x, long n);
      86             : GEN  gsube(GEN *x, GEN y);
      87             : GEN  gsub1e(GEN *x);
      88             : GEN  gshift_right(GEN x, long n);
      89             : 
      90             : GEN  asympnum0(GEN u, long muli, GEN alpha, long prec);
      91             : GEN  derivnum0(GEN a, GEN code, GEN ind, long prec);
      92             : GEN  derivfun0(GEN code, GEN args, long prec);
      93             : GEN  direuler0(GEN a, GEN b, GEN code, GEN c);
      94             : GEN  direuler_bad(void *E, GEN (*eval)(void *, GEN, long), GEN a, GEN b, GEN c, GEN Sbad);
      95             : void forcomposite(GEN a, GEN b, GEN code);
      96             : void fordiv(GEN a, GEN code);
      97             : void fordivfactored(GEN a, GEN code);
      98             : void forell0(long a, long b, GEN code, long flag);
      99             : void forperm0(GEN k, GEN code);
     100             : void forprime(GEN a, GEN b, GEN code);
     101             : void forstep(GEN a, GEN b, GEN s, GEN code);
     102             : void forsubgroup0(GEN cyc, GEN bound, GEN code);
     103             : void forsubset0(GEN nk, GEN code);
     104             : void forvec(GEN x, GEN code, long flag);
     105             : void forpart0(GEN k, GEN code , GEN nbound, GEN abound);
     106             : GEN  intcirc0(GEN a, GEN R, GEN code, GEN tab, long prec);
     107             : GEN  intfuncinit0(GEN a, GEN b, GEN code, long m, long prec);
     108             : GEN  intnum0(GEN a, GEN b, GEN code, GEN tab, long prec);
     109             : GEN  intnumgauss0(GEN a, GEN b, GEN code, GEN tab, long prec);
     110             : GEN  intnumromb0_bitprec(GEN a, GEN b, GEN code, long flag, long bit);
     111             : GEN  limitnum0(GEN u, long muli, GEN alpha, long prec);
     112             : GEN  matrice(GEN nlig, GEN ncol, GEN code);
     113             : void pariplot(GEN a, GEN b, GEN code, GEN ysmlu, GEN ybigu, long prec);
     114             : GEN  prodeuler0(GEN a, GEN b, GEN code, long prec);
     115             : GEN  prodinf0(GEN a, GEN code, long flag, long prec);
     116             : GEN  produit(GEN a, GEN b, GEN code, GEN x);
     117             : GEN  somme(GEN a, GEN b, GEN code, GEN x);
     118             : GEN  sumalt0(GEN a, GEN code,long flag, long prec);
     119             : GEN  sumdivexpr(GEN num, GEN code);
     120             : GEN  sumdivmultexpr(GEN num, GEN code);
     121             : GEN  suminf0(GEN a, GEN code, long prec);
     122             : GEN  sumnum0(GEN a, GEN code, GEN tab, long prec);
     123             : GEN  sumnumap0(GEN a, GEN code, GEN tab, long prec);
     124             : GEN  sumnumlagrange0(GEN a, GEN code, GEN tab, long prec);
     125             : GEN  sumnummonien0(GEN a, GEN code, GEN tab, long prec);
     126             : GEN  sumpos0(GEN a, GEN code, long flag,long prec);
     127             : GEN  vecexpr0(GEN nmax, GEN code, GEN pred);
     128             : GEN  vecexpr1(GEN nmax, GEN code, GEN pred);
     129             : GEN  vecteursmall(GEN nmax, GEN code);
     130             : GEN  vecteur(GEN nmax, GEN n);
     131             : GEN  vvecteur(GEN nmax, GEN n);
     132             : GEN  zbrent0(GEN a, GEN b, GEN code, long prec);
     133             : GEN  solvestep0(GEN a, GEN b, GEN step, GEN code, long flag, long prec);
     134             : 
     135             : GEN  ploth0(GEN a, GEN b, GEN code, long flag, long n, long prec);
     136             : GEN  psploth0(GEN a,GEN b,GEN code,long flag,long n,long prec);
     137             : GEN  plotrecth0(long ne,GEN a,GEN b,GEN code,ulong flags,long n,long prec);
     138             : 
     139             : GEN  listcreate_gp(long n);
     140             : 
     141             : /* mt */
     142             : void mt_sigint(void);
     143             : void mt_err_recover(long er);
     144             : void mt_init_stack(size_t s);
     145             : int  mt_is_thread(void);
     146             : GEN  parapply_worker(GEN d, GEN code);
     147             : GEN  pareval_worker(GEN code);
     148             : void parfor0(GEN a, GEN b, GEN code, GEN code2);
     149             : GEN  parfor_worker(GEN i, GEN C);
     150             : void parforprime0(GEN a, GEN b, GEN code, GEN code2);
     151             : void parforvec0(GEN a, GEN code, GEN code2, long flag);
     152             : GEN  parvector_worker(GEN i, GEN C);
     153             : GEN  polmodular_worker(ulong p, ulong t, ulong L, GEN hilb, GEN factu,
     154             :        GEN vne, GEN vinfo, long compute_derivs, GEN j_powers, GEN fdb);
     155             : GEN  nmV_polint_center_tree_worker(GEN Va, GEN T, GEN R, GEN xa, GEN m2);
     156             : GEN  nmV_chinese_center_tree_seq(GEN A, GEN P, GEN T, GEN R);
     157             : GEN  F2xq_log_Coppersmith_worker(GEN u, long i, GEN V, GEN R);
     158             : GEN  Flxq_log_Coppersmith_worker(GEN u, long i, GEN V, GEN R);
     159             : GEN  Fp_log_sieve_worker(long a, long prmax, GEN C, GEN c, GEN Ci, GEN ci, GEN pr, GEN sz);
     160             : GEN  ZX_resultant_worker(GEN P, GEN A, GEN B, GEN dB);
     161             : GEN  ZX_ZXY_resultant_worker(GEN P, GEN A, GEN B, GEN dB, GEN v);
     162             : GEN  ZM_det_worker(GEN P, GEN A);
     163             : GEN  ZM_inv_worker(GEN P, GEN A);
     164             : GEN  aprcl_step4_worker(ulong q, GEN pC, GEN N, GEN v);
     165             : GEN  aprcl_step6_worker(GEN r, long t, GEN N, GEN N1, GEN et);
     166             : GEN  gen_crt(const char *str, GEN worker, GEN dB, ulong bound, long mmin, GEN *pt_mod,
     167             :              GEN crt(GEN, GEN, GEN*), GEN center(GEN, GEN, GEN));
     168             : 
     169             : /* Relative number fields */
     170             : enum { rnf_NFABS = 1, rnf_MAPS };
     171             : 
     172             : /* Finite fields */
     173             : enum { t_FF_FpXQ = 0, t_FF_Flxq = 1, t_FF_F2xq = 2 };
     174             : GEN FF_ellinit(GEN E, GEN fg);
     175             : GEN FF_elldata(GEN E, GEN fg);
     176             : 
     177             : /* L functions */
     178             : enum { t_LFUN_GENERIC, t_LFUN_ZETA, t_LFUN_NF, t_LFUN_ELL, t_LFUN_KRONECKER,
     179             :        t_LFUN_CHIZ, t_LFUN_CHIGEN, t_LFUN_ETA,
     180             :        t_LFUN_DIV, t_LFUN_MUL, t_LFUN_CONJ,
     181             :        t_LFUN_SYMSQ_ELL, t_LFUN_QF, t_LFUN_ARTIN, t_LFUN_MFCLOS,
     182             :        t_LFUN_GENUS2 };
     183             : enum { t_LDESC_INIT, t_LDESC_THETA, t_LDESC_PRODUCT };
     184             : 
     185             : /* Elliptic curves */
     186             : /* common to Q and Rg */
     187             : enum { R_PERIODS = 1, R_ETA, R_ROOTS, R_AB };
     188             : 
     189             : enum { Qp_ROOT = 1, Qp_TATE };
     190             : enum { Q_GROUPGEN = 5, Q_GLOBALRED, Q_ROOTNO, Q_MINIMALMODEL };
     191             : enum { NF_MINIMALMODEL = 1, NF_GLOBALRED, NF_MINIMALPRIMES, NF_ROOTNO };
     192             : 
     193             : /* common to Fp and Fq */
     194             : enum { FF_CARD = 1, FF_GROUP, FF_GROUPGEN, FF_O };
     195             : 
     196             : /* for Buchall_param */
     197             : enum { fupb_NONE, fupb_RELAT, fupb_LARGE, fupb_PRECI };
     198             : 
     199             : /* Polycyclic presentation for the classgroup of discriminant D */
     200             : typedef struct {
     201             :   long D; /* Negative discriminant */
     202             :   long h; /* Size of classgroup */
     203             :   long enum_cnt; /* Either h or h/2 (if L0 is set) */
     204             :   /* If nonzero, L0=L[0] and n[0]=2 and classpoly is a perfect square
     205             :    * (and we enumerate each double root just once), default is 0 */
     206             :   long L0;
     207             :   /* Product of primes L that are prohibited as norms of generators or
     208             :    * auxilliary prime forms (by default, primes that make enumeration hard) */
     209             :   long Lfilter;
     210             :   /* Norms of implicit generators (primeforms a=(L*x^2+b*x*y+c*y^2)
     211             :    * with norm L and b >=0) */
     212             :   long *L;
     213             :   long *m; /* products of relative orders: m[i] is the order of <g_1,...,g_i> */
     214             :   long *n; /* Relative orders */
     215             :   long *o; /* Absolute orders */
     216             :   /* Power relations (a[i]^n[i] = a[0]^e[0]*...*a[i-1]^e[i-1], where e
     217             :    * is an exponent vector of length i stored at offset binom(i,2) of r) */
     218             :   long *r;
     219             :   long *orient_p; /* Optional list of norms of orienting primes p ... */
     220             :   long *orient_q; /* or product of primes p*q (q=1 when only p is needed) */
     221             :   long *orient_reps; /* Representation of orienting norm p*q in terms of Ls */
     222             :   long inv; /* Attached invariant */
     223             :   long k; /* Number of generators */
     224             :   GEN _data; /* Storage space for the above arrays */
     225             : } classgp_pcp_struct;
     226             : typedef classgp_pcp_struct classgp_pcp_t[1];
     227             : 
     228             : /* Represents the data in the equation(s)
     229             :  *   4p = t^2 - v^2 D = t^2 - v^2 u^2 D_K = w^2 D_K.
     230             :  * t is the absolute trace, so always > 0.
     231             :  * T is a twisting parameter, which satisfies (T|p) == -1. */
     232             : typedef struct {
     233             :   long D, t, u, v;
     234             :   ulong p, pi, s2, T;
     235             : } norm_eqn_struct;
     236             : typedef norm_eqn_struct norm_eqn_t[1];
     237             : 
     238             : #define zv_to_longptr(v) (&((v)[1]))
     239             : #define zv_to_ulongptr(v) ((ulong *)&((v)[1]))
     240             : 
     241             : /* Modular invariants */
     242             : #define INV_J       0
     243             : #define INV_F       1
     244             : #define INV_F2      2
     245             : #define INV_F3      3
     246             : #define INV_F4      4
     247             : #define INV_G2      5
     248             : #define INV_W2W3    6
     249             : #define INV_F8      8
     250             : #define INV_W3W3    9
     251             : #define INV_W2W5    10
     252             : #define INV_W2W7    14
     253             : #define INV_W3W5    15
     254             : #define INV_W3W7    21
     255             : #define INV_W2W3E2  23
     256             : #define INV_W2W5E2  24
     257             : #define INV_W2W13   26
     258             : #define INV_W2W7E2  27
     259             : #define INV_W3W3E2  28
     260             : #define INV_W5W7    35
     261             : #define INV_W3W13   39
     262             : 
     263             : /* Get coefficient of x^d in f, assuming f is nonzero. */
     264    13895879 : INLINE ulong Flx_coeff(GEN f, long d) { return f[d + 2]; }
     265             : /* Return the root of f, assuming deg(f) = 1. */
     266      224353 : INLINE ulong Flx_deg1_root(GEN f, ulong p) {
     267      224353 :   if (degpol(f) != 1) pari_err_BUG("Flx_deg1_root");
     268      224354 :   return Fl_div(Fl_neg(Flx_coeff(f, 0), p), Flx_coeff(f, 1), p);
     269             : }
     270             : 
     271             : /* Allocation / gerepile */
     272             : long   getdebugvar(void);
     273             : void   setdebugvar(long n);
     274             : void   debug_stack(void);
     275             : void   fill_stack(void);
     276             : void   minim_alloc(long n, double ***q, GEN *x, double **y,  double **z, double **v);
     277             : int    pop_entree_block(entree *ep, long loc);
     278             : int    pop_val_if_newer(entree *ep, long loc);
     279             : 
     280             : /* general printing */
     281             : void print_errcontext(PariOUT *out, const char *msg, const char *s, const char *entry);
     282             : void print_prefixed_text(PariOUT *out, const char *s, const char *prefix, const char *str);
     283             : INLINE void
     284          60 : print_text(const char *s) { print_prefixed_text(pariOut, s,NULL,NULL); }
     285             : INLINE void
     286        5341 : out_print_text(PariOUT *out, const char *s) { print_prefixed_text(out, s,NULL,NULL); }
     287             : INLINE long
     288     1518945 : is_keyword_char(char c) { return (isalnum((int)c) || c=='_'); }
     289             : 
     290             : /* Interfaces (GP, etc.) */
     291             : hashtable *hash_from_link(GEN e, GEN names, int use_stack);
     292             : void gen_relink(GEN x, hashtable *table);
     293             : entree* do_alias(entree *ep);
     294             : char* get_sep(const char *t);
     295             : long get_int(const char *s, long dflt);
     296             : ulong get_uint(const char *s);
     297             : void gp_initrc(pari_stack *p_A);
     298             : 
     299             : void pari_sigint(const char *s);
     300             : pariFILE *pari_last_tmp_file(void);
     301             : void* get_stack(double fraction, long min);
     302             : void  free_graph(void);
     303             : void  initout(int initerr);
     304             : void  resetout(int initerr);
     305             : void  init_linewrap(long w);
     306             : void  print_functions_hash(const char *s);
     307             : GEN   readbin(const char *name, FILE *f, int *vector);
     308             : int   term_height(void);
     309             : int   term_width(void);
     310             : /* gp_colors */
     311             : void decode_color(long n, long *c);
     312             : 
     313             : /* defaults */
     314             : extern long precreal;
     315             : 
     316             : void lim_lines_output(char *s, long n, long max);
     317             : int tex2mail_output(GEN z, long n);
     318             : void gen_output(GEN x);
     319             : void fputGEN_pariout(GEN x, pariout_t *T, FILE *out);
     320             : 
     321             : void parsestate_reset(void);
     322             : void parsestate_save(struct pari_parsestate *state);
     323             : void parsestate_restore(struct pari_parsestate *state);
     324             : 
     325             : void compilestate_reset(void);
     326             : void compilestate_save(struct pari_compilestate *comp);
     327             : void compilestate_restore(struct pari_compilestate *comp);
     328             : 
     329             : void evalstate_clone(void);
     330             : void evalstate_reset(void);
     331             : void evalstate_restore(struct pari_evalstate *state);
     332             : GEN  evalstate_restore_err(struct pari_evalstate *state);
     333             : void evalstate_save(struct pari_evalstate *state);
     334             : void varstate_save(struct pari_varstate *s);
     335             : void varstate_restore(struct pari_varstate *s);
     336             : 
     337             : void mtstate_save(long *pending);
     338             : void mtstate_reset(void);
     339             : void mtstate_restore(long *pending);
     340             : 
     341             : void debug_context(void);
     342             : 
     343             : typedef struct {
     344             :   const char *s;
     345             :   size_t ls;
     346             :   char **dir;
     347             : } forpath_t;
     348             : void forpath_init(forpath_t *T, gp_path *path, const char *s);
     349             : char *forpath_next(forpath_t *T);
     350             : 
     351             : /* GP output && output format */
     352             : void gpwritebin(const char *s, GEN x);
     353             : extern char *current_logfile;
     354             : 
     355             : /* colors */
     356             : extern long    gp_colors[];
     357             : extern int     disable_color;
     358             : 
     359             : /* entrees */
     360             : #define EpVALENCE(ep) ((ep)->valence & 0xFF)
     361             : #define EpSTATIC(ep) ((ep)->valence & 0x100)
     362             : #define EpSETSTATIC(ep) ((ep)->valence |= 0x100)
     363             : enum { EpNEW = 100, EpALIAS, EpVAR, EpINSTALL };
     364             : #define initial_value(ep) ((ep)+1)
     365             : 
     366             : /* functions lists */
     367             : extern const long functions_tblsz;  /* hashcodes table size */
     368             : extern entree **functions_hash;   /* functions hashtable */
     369             : extern entree **defaults_hash;    /* defaults hashtable */
     370             : 
     371             : /* buffers */
     372             : typedef struct Buffer {
     373             :   char *buf;
     374             :   ulong len;
     375             :   jmp_buf env;
     376             : } Buffer;
     377             : Buffer *new_buffer(void);
     378             : void delete_buffer(Buffer *b);
     379             : void fix_buffer(Buffer *b, long newlbuf);
     380             : 
     381             : typedef struct {
     382             :   const char *s; /* source */
     383             :   char *t, *end; /* target, last char read */
     384             :   int in_string, in_comment, more_input, wait_for_brace;
     385             :   Buffer *buf;
     386             : } filtre_t;
     387             : void init_filtre(filtre_t *F, Buffer *buf);
     388             : Buffer *filtered_buffer(filtre_t *F);
     389             : void kill_buffers_upto_including(Buffer *B);
     390             : void pop_buffer(void);
     391             : void kill_buffers_upto(Buffer *B);
     392             : int gp_read_line(filtre_t *F, const char *PROMPT);
     393             : void parse_key_val(char *src, char **ps, char **pt);
     394             : extern int (*cb_pari_get_line_interactive)(const char*, const char*, filtre_t *F);
     395             : extern char *(*cb_pari_fgets_interactive)(char *s, int n, FILE *f);
     396             : int get_line_from_file(const char *prompt, filtre_t *F, FILE *file);
     397             : void pari_skip_space(char **s);
     398             : void pari_skip_alpha(char **s);
     399             : char *pari_translate_string(const char *src, char *s, char *entry);
     400             : 
     401             : gp_data *default_gp_data(void);
     402             : 
     403             : typedef char *(*fgets_t)(char *, int, void*);
     404             : 
     405             : typedef struct input_method {
     406             : /* optional */
     407             :   fgets_t fgets;  /* like libc fgets() but last argument is (void*) */
     408             : /* mandatory */
     409             :   char * (*getline)(char**, int f, struct input_method*, filtre_t *F);
     410             :   int free; /* boolean: must we free the output of getline() ? */
     411             : /* optional */
     412             :   const char *prompt, *prompt_cont;
     413             :   void *file;  /* can be used as last argument for fgets() */
     414             : } input_method;
     415             : 
     416             : int input_loop(filtre_t *F, input_method *IM);
     417             : char *file_input(char **s0, int junk, input_method *IM, filtre_t *F);
     418             : char *file_getline(Buffer *b, char **s0, input_method *IM);
     419             : 
     420             : /* readline */
     421             : typedef struct {
     422             :   /* pointers to readline variables/functions */
     423             :   char **line_buffer;
     424             :   int *point;
     425             :   int *end;
     426             :   char **(*completion_matches)(const char *, char *(*)(const char*, int));
     427             :   char *(*filename_completion_function)(const char *, int);
     428             :   char *(*username_completion_function)(const char *, int);
     429             :   int (*insert)(int, int);
     430             :   int *completion_append_character;
     431             : 
     432             :   /* PARI-specific */
     433             :   int back;  /* rewind the cursor by this number of chars */
     434             : } pari_rl_interface;
     435             : 
     436             : /* Code which wants to use readline needs to do the following:
     437             : 
     438             : #include <readline.h>
     439             : #include <paripriv.h>
     440             : pari_rl_interface pari_rl;
     441             : pari_use_readline(pari_rl);
     442             : 
     443             : This will initialize the pari_rl structure. A pointer to this structure
     444             : must be given as first argument to all PARI readline functions. */
     445             : 
     446             : /* IMPLEMENTATION NOTE: this really must be a macro (not a function),
     447             :  * since we refer to readline symbols. */
     448             : #define pari_use_readline(pari_rl) do {\
     449             :     (pari_rl).line_buffer = &rl_line_buffer; \
     450             :     (pari_rl).point = &rl_point; \
     451             :     (pari_rl).end = &rl_end; \
     452             :     (pari_rl).completion_matches = &rl_completion_matches; \
     453             :     (pari_rl).filename_completion_function = &rl_filename_completion_function; \
     454             :     (pari_rl).username_completion_function = &rl_username_completion_function; \
     455             :     (pari_rl).insert = &rl_insert; \
     456             :     (pari_rl).completion_append_character = &rl_completion_append_character; \
     457             :     (pari_rl).back = 0; } while(0)
     458             : 
     459             : /* FIXME: EXPORT AND DOCUMENT THE FOLLOWING */
     460             : 
     461             : /* PROBABLY NOT IN THE RIGHT FILE, SORT BY THEME */
     462             : 
     463             : /* multiprecision */
     464             : GEN   adduispec_offset(ulong s, GEN x, long offset, long nx);
     465             : int   lgcdii(ulong* d, ulong* d1, ulong* u, ulong* u1, ulong* v, ulong* v1, ulong vmax);
     466             : ulong rgcduu(ulong d, ulong d1, ulong vmax, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);
     467             : ulong xgcduu(ulong d, ulong d1, int f, ulong* v, ulong* v1, long *s);
     468             : ulong xxgcduu(ulong d, ulong d1, int f, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);
     469             : GEN   divgunu(GEN x, ulong i);
     470             : GEN   divrunu(GEN x, ulong i);
     471             : GEN   muliispec(GEN x, GEN y, long nx, long ny);
     472             : GEN   red_montgomery(GEN T, GEN N, ulong inv);
     473             : GEN   sqrispec(GEN x, long nx);
     474             : ulong *convi(GEN x, long *l);
     475             : 
     476             : int approx_0(GEN x, GEN y);
     477             : GEN bernfrac_using_zeta(long n);
     478             : 
     479             : /* powers */
     480             : GEN    rpowuu(ulong a, ulong n, long prec);
     481             : 
     482             : /* floats */
     483             : double dabs(double s, double t);
     484             : double darg(double s, double t);
     485             : void   dcxlog(double s, double t, double *a, double *b);
     486             : double dnorm(double s, double t);
     487             : double dbllog2(GEN z);
     488             : 
     489             : /* hnf */
     490             : GEN hnfadd(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);
     491             : GEN hnfadd_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);
     492             : GEN hnfspec_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);
     493             : GEN hnfspec(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);
     494             : GEN mathnfspec(GEN x, GEN *ptperm, GEN *ptdep, GEN *ptB, GEN *ptC);
     495             : GEN ZM_hnfmodall_i(GEN x, GEN dm, long flag);
     496             : 
     497             : GEN LLL_check_progress(GEN Bnorm, long n0, GEN m, int final, long *ti_LLL);
     498             : 
     499             : /* integer factorization / discrete log */
     500             : ulong is_kth_power(GEN x, ulong p, GEN *pt);
     501             : GEN   mpqs(GEN N);
     502             : ulong gcduodd(ulong x, ulong y);
     503             : 
     504             : /* Polynomials */
     505             : /* a) Arithmetic/conversions */
     506             : GEN  lift_if_rational(GEN x);
     507             : GEN  monomial(GEN a, long degpol, long v);
     508             : GEN  monomialcopy(GEN a, long degpol, long v);
     509             : GEN  ser2pol_i(GEN x, long lx);
     510             : GEN  ser2rfrac_i(GEN x);
     511             : GEN  swap_vars(GEN b0, long v);
     512             : GEN  RgX_recipspec_shallow(GEN x, long l, long n);
     513             : 
     514             : /* b) Modular */
     515             : GEN  bezout_lift_fact(GEN T, GEN Tmod, GEN p, long e);
     516             : GEN  FpX_quad_root(GEN x, GEN p, int unknown);
     517             : GEN  polsym_gen(GEN P, GEN y0, long n, GEN T, GEN N);
     518             : GEN  ZXQ_charpoly_sqf(GEN A, GEN B, long *lambda, long v);
     519             : GEN  ZX_disc_all(GEN,ulong);
     520             : GEN  ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);
     521             : GEN  ZX_ZXY_resultant_all(GEN A, GEN B, long *lambda, GEN *LPRS);
     522             : GEN  RgXQ_minpoly_naive(GEN y, GEN P);
     523             : 
     524             : GEN FlxqM_mul_Kronecker(GEN A, GEN B, GEN T, ulong p);
     525             : GEN FqM_mul_Kronecker(GEN x, GEN y, GEN T, GEN p);
     526             : 
     527             : /* c) factorization */
     528             : GEN chk_factors_get(GEN lt, GEN famod, GEN c, GEN T, GEN N);
     529             : long cmbf_maxK(long nb);
     530             : GEN ZX_DDF(GEN x);
     531             : GEN initgaloisborne(GEN T, GEN dn, long prec, GEN *pL, GEN *pprep, GEN *pdis);
     532             : GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN *ptdy);
     533             : GEN quicktrace(GEN x, GEN sym);
     534             : 
     535             : /* pari_init / pari_close */
     536             : void pari_close_compiler(void);
     537             : void pari_close_evaluator(void);
     538             : void pari_close_files(void);
     539             : void pari_close_floats(void);
     540             : void pari_close_homedir(void);
     541             : void pari_close_parser(void);
     542             : void pari_close_paths(void);
     543             : void pari_close_primes(void);
     544             : void pari_init_buffers(void);
     545             : void pari_init_compiler(void);
     546             : void pari_init_defaults(void);
     547             : void pari_init_evaluator(void);
     548             : void pari_init_files(void);
     549             : void pari_init_floats(void);
     550             : void pari_init_homedir(void);
     551             : void pari_init_graphics(void);
     552             : void pari_init_parser(void);
     553             : void pari_init_rand(void);
     554             : void pari_init_paths(void);
     555             : void pari_init_primetab(void);
     556             : void pari_init_seadata(void);
     557             : void pari_pthread_init_primetab(void);
     558             : void pari_pthread_init_seadata(void);
     559             : void pari_pthread_init_varstate(void);
     560             : void pari_thread_close_files(void);
     561             : void pari_thread_init_primetab(void);
     562             : void pari_thread_init_seadata(void);
     563             : void pari_thread_init_varstate(void);
     564             : 
     565             : /* BY FILES */
     566             : 
     567             : /* parinf.h */
     568             : 
     569             : GEN fincke_pohst(GEN a,GEN BOUND,long stockmax,long PREC, FP_chk_fun *CHECK);
     570             : void init_zlog(zlog_S *S, GEN bid);
     571             : GEN  log_gen_arch(zlog_S *S, long index);
     572             : GEN  log_gen_pr(zlog_S *S, long index, GEN nf, long e);
     573             : GEN    poltobasis(GEN nf,GEN x);
     574             : GEN    coltoalg(GEN nf,GEN x);
     575             : 
     576             : GEN    get_arch_real(GEN nf,GEN x,GEN *emb,long prec);
     577             : GEN    make_integral(GEN nf, GEN L0, GEN f, GEN listpr);
     578             : GEN    rnfallbase(GEN nf, GEN *ppol, GEN *pD, GEN *pd, GEN *pfi);
     579             : GEN    subgroupcondlist(GEN cyc, GEN bound, GEN listKer);
     580             : GEN    ideallog_sgn(GEN nf, GEN x, GEN sgn, GEN bid);
     581             : 
     582             : /* Qfb.c */
     583             : 
     584             : GEN     redimagsl2(GEN q, GEN *U);
     585             : GEN     redrealsl2(GEN V, GEN d, GEN rd);
     586             : GEN     redrealsl2step(GEN A, GEN d, GEN rd);
     587             : 
     588             : /* alglin1.c */
     589             : 
     590             : typedef long (*pivot_fun)(GEN,GEN,long,GEN);
     591             : GEN ZM_pivots(GEN x0, long *rr);
     592             : GEN RgM_pivots(GEN x0, GEN data, long *rr, pivot_fun pivot);
     593             : void RgMs_structelim_col(GEN M, long nbcol, long nbrow, GEN A, GEN *p_col, GEN *p_lin);
     594             : 
     595             : /* arith1.c */
     596             : 
     597             : int     is_gener_Fp(GEN x, GEN p, GEN p_1, GEN L);
     598             : int     is_gener_Fl(ulong x, ulong p, ulong p_1, GEN L);
     599             : 
     600             : /* arith2.c */
     601             : 
     602             : int     divisors_init(GEN n, GEN *pP, GEN *pE);
     603             : long    set_optimize(long what, GEN g);
     604             : 
     605             : /* base1.c */
     606             : 
     607             : GEN zk_galoisapplymod(GEN nf, GEN z, GEN S, GEN p);
     608             : 
     609             : /* base2.c */
     610             : 
     611             : GEN     dim1proj(GEN prh);
     612             : GEN     gen_if_principal(GEN bnf, GEN x);
     613             : GEN     polsymmodp(GEN g, GEN p);
     614             : GEN     nfbasis_gp(GEN T);
     615             : 
     616             : /* base3.c */
     617             : 
     618             : void    check_nfelt(GEN x, GEN *den);
     619             : GEN     zk_ei_mul(GEN nf, GEN x, long i);
     620             : GEN     zlog_pr(GEN nf, GEN a, GEN sprk);
     621             : GEN     vzlog_pr(GEN nf, GEN v, GEN sprk);
     622             : GEN     zlog_pr_init(GEN nf, GEN pr, long k);
     623             : 
     624             : /* base4.c */
     625             : 
     626             : GEN     factorbackprime(GEN nf, GEN L, GEN e);
     627             : 
     628             : /* bb_group.c */
     629             : 
     630             : GEN     producttree_scheme(long n);
     631             : 
     632             : /* bibli2.c */
     633             : 
     634             : GEN sort_factor_pol(GEN y, int (*cmp)(GEN,GEN));
     635             : 
     636             : /* buch1.c */
     637             : 
     638             : long   bnf_increase_LIMC(long LIMC, long LIMCMAX);
     639             : 
     640             : /* buch2.c */
     641             : 
     642             : typedef struct GRHprime_t { ulong p; double logp; GEN dec; } GRHprime_t;
     643             : typedef struct GRHcheck_t { double cD, cN; GRHprime_t *primes; long clone, nprimes, maxprimes; ulong limp; forprime_t P; } GRHcheck_t;
     644             : void    free_GRHcheck(GRHcheck_t *S);
     645             : void    init_GRHcheck(GRHcheck_t *S, long N, long R1, double LOGD);
     646             : void    GRH_ensure(GRHcheck_t *S, long nb);
     647             : ulong   GRH_last_prime(GRHcheck_t *S);
     648             : int     GRHok(GRHcheck_t *S, double L, double SA, double SB);
     649             : GEN     extract_full_lattice(GEN x);
     650             : GEN     init_red_mod_units(GEN bnf, long prec);
     651             : GEN     isprincipalarch(GEN bnf, GEN col, GEN kNx, GEN e, GEN dx, long *pe);
     652             : GEN     red_mod_units(GEN col, GEN z);
     653             : 
     654             : /* buch3.c */
     655             : 
     656             : GEN     minkowski_bound(GEN D, long N, long r2, long prec);
     657             : int     subgroup_conductor_ok(GEN H, GEN L);
     658             : GEN     subgrouplist_cond_sub(GEN bnr, GEN C, GEN bound);
     659             : 
     660             : /* buch4.c */
     661             : 
     662             : GEN     bnfsunit0(GEN bnf, GEN S, long flag, long prec);
     663             : 
     664             : /* crvwtors.c */
     665             : 
     666             : void random_curves_with_m_torsion(ulong *a4, ulong *a6, ulong *tx, ulong *ty, long ncurves, long m, ulong p);
     667             : 
     668             : /* dirichlet.c */
     669             : GEN direuler_factor(GEN s, long n);
     670             : 
     671             : /* elliptic.c */
     672             : 
     673             : void ellprint(GEN e);
     674             : 
     675             : /* ecpp.c */
     676             : GEN     ecpp0(GEN N, GEN param, GEN* X0);
     677             : long    ecpp_isvalid0(GEN cert, ulong trustbits);
     678             : 
     679             : /* es.c */
     680             : 
     681             : const char * eng_ord(long i);
     682             : void    filestate_restore(pariFILE *F);
     683             : void    killallfiles(void);
     684             : pariFILE* newfile(FILE *f, const char *name, int type);
     685             : int     popinfile(void);
     686             : pariFILE* try_pipe(const char *cmd, int flag);
     687             : 
     688             : /* Flxq_log.c */
     689             : 
     690             : GEN Flxq_log_index(GEN a0, GEN b0, GEN m, GEN T0, ulong p);
     691             : int Flxq_log_use_index(GEN m, GEN T0, ulong p);
     692             : 
     693             : /* FlxqE.c */
     694             : 
     695             : GEN     ZpXQ_norm_pcyc(GEN x, GEN T, GEN q, GEN p);
     696             : long    zx_is_pcyc(GEN T);
     697             : 
     698             : /* FpV.c */
     699             : 
     700             : GEN FpMs_leftkernel_elt_col(GEN M, long nbcol, long nbrow, GEN p);
     701             : 
     702             : /* FpXQX_factor.c */
     703             : 
     704             : GEN FpXQX_factor_Berlekamp(GEN x, GEN T, GEN p);
     705             : 
     706             : /* forprime.c*/
     707             : 
     708             : void    init_modular(forprime_t *S);
     709             : void    init_modular_big(forprime_t *S);
     710             : void    init_modular_small(forprime_t *S);
     711             : 
     712             : /* galconj.c */
     713             : 
     714             : GEN     galoiscosets(GEN O, GEN perm);
     715             : GEN     matrixnorm(GEN M, long prec);
     716             : 
     717             : /* galois.c */
     718             : 
     719             : GEN     polgaloisnamesbig(long n, long k);
     720             : 
     721             : /* gen1.c */
     722             : 
     723             : GEN     gred_rfrac_simple(GEN n, GEN d);
     724             : GEN     sqr_ser_part(GEN x, long l1, long l2);
     725             : 
     726             : /* gen3.c */
     727             : 
     728             : GEN     gsubst_expr(GEN pol, GEN from, GEN to);
     729             : 
     730             : /* hash.c */
     731             : 
     732             : hashtable *hashstr_import_static(hashentry *e, ulong size);
     733             : 
     734             : /* hyperell.c */
     735             : 
     736             : GEN     ZlXQX_hyperellpadicfrobenius(GEN H, GEN T, ulong p, long n);
     737             : 
     738             : /* ifactor1.c */
     739             : 
     740             : ulong   snextpr(ulong p, byteptr *d, long *rcn, long *q, long k);
     741             : 
     742             : /* intnum.c */
     743             : 
     744             : GEN     contfraceval_inv(GEN CF, GEN tinv, long nlim);
     745             : 
     746             : /* mftrace.c */
     747             : 
     748             : void pari_close_mf(void);
     749             : GEN mfchartovec(GEN CHI);
     750             : GEN sqrtmtnmodN(long N, long t, long n);
     751             : GEN mfcharcxeval(GEN CHI, long m, long prec);
     752             : GEN doublecharsum(GEN CHI1, GEN CHI2, GEN cusp, long e, long a1, long a2);
     753             : GEN mftsteisencusp(GEN CHI1, GEN CHI2, GEN cusp, long e, long k, long lim);
     754             : GEN mfeisenchi1chi2cusp(GEN CHI1, GEN CHI2, GEN cusp, long e, long k, long lim);
     755             : long polishomogeneous(GEN P);
     756             : GEN mfqk(long k, long N);
     757             : GEN mfsk(GEN CHI, GEN Q, long k);
     758             : GEN mfheckeU(GEN F, long d);
     759             : GEN charLFwtk(long k, GEN CHI);
     760             : GEN sertocol(GEN S);
     761             : 
     762             : /* prime.c */
     763             : 
     764             : long    BPSW_psp_nosmalldiv(GEN N);
     765             : int     Fl_MR_Jaeschke(ulong n, long k);
     766             : int     MR_Jaeschke(GEN n);
     767             : long    isanypower_nosmalldiv(GEN N, GEN *px);
     768             : void    prime_table_next_p(ulong a, byteptr *pd, ulong *pp, ulong *pn);
     769             : 
     770             : /* perm.c */
     771             : 
     772             : long    cosets_perm_search(GEN C, GEN p);
     773             : GEN     group_export_GAP(GEN G);
     774             : GEN     group_export_MAGMA(GEN G);
     775             : GEN     perm_generate(GEN S, GEN H, long o);
     776             : long    perm_relorder(GEN p, GEN S);
     777             : 
     778             : /* FpX_factcantor.c */
     779             : 
     780             : GEN     F2x_factcantor(GEN f, long flag);
     781             : GEN     Flx_factcantor(GEN f, ulong p, long flag);
     782             : GEN     FpX_factcantor(GEN f, GEN pp, long flag);
     783             : long    ddf_to_nbfact(GEN D);
     784             : GEN     ddf_to_simplefact(GEN D, long n);
     785             : GEN     factcantor0(GEN f, GEN pp, long flag);
     786             : 
     787             : /* polarit2.c */
     788             : 
     789             : GEN     sylvestermatrix_i(GEN x, GEN y);
     790             : 
     791             : /* polclass.c */
     792             : 
     793             : GEN polclass0(long D, long inv, long xvar, GEN *db);
     794             : 
     795             : /* polmodular.c */
     796             : 
     797             : GEN polmodular0_ZM(long L, long inv, GEN J, GEN Q, int compute_derivs, GEN *db);
     798             : GEN Flm_Fl_polmodular_evalx(GEN phi, long L, ulong j, ulong p, ulong pi);
     799             : GEN polmodular_db_init(long inv);
     800             : void polmodular_db_clear(GEN db);
     801             : void polmodular_db_add_level(GEN *db, long L, long inv);
     802             : void polmodular_db_add_levels(GEN *db, long *levels, long k, long inv);
     803             : GEN polmodular_db_for_inv(GEN db, long inv);
     804             : GEN polmodular_db_getp(GEN fdb, long L, ulong p);
     805             : 
     806             : long modinv_level(long inv);
     807             : long modinv_degree(long *p1, long *p2, long inv);
     808             : long modinv_ramified(long D, long inv);
     809             : long modinv_j_from_2double_eta(GEN F, long inv, ulong *j, ulong x0, ulong x1, ulong p, ulong pi);
     810             : GEN double_eta_raw(long inv);
     811             : ulong modfn_root(ulong j, norm_eqn_t ne, long inv);
     812             : long modfn_unambiguous_root(ulong *r, long inv, ulong j0, norm_eqn_t ne, GEN jdb);
     813             : GEN qfb_nform(long D, long n);
     814             : 
     815             : /* Fle.c */
     816             : 
     817             : ulong   Flj_order_ufact(GEN P, ulong n, GEN F, ulong a4, ulong p, ulong pi);
     818             : 
     819             : /* polarit3.c */
     820             : 
     821             : GEN     Flm_Frobenius_pow(GEN M, long d, GEN T, ulong p);
     822             : GEN     FpM_Frobenius_pow(GEN M, long d, GEN T, GEN p);
     823             : GEN     FpX_compositum(GEN A, GEN B, GEN p);
     824             : GEN     FpX_direct_compositum(GEN A, GEN B, GEN p);
     825             : ulong   ZX_ZXY_ResBound(GEN A, GEN B, GEN dB);
     826             : GEN     ffinit_Artin_Shreier(GEN ip, long l);
     827             : GEN     ffinit_rand(GEN p, long n);
     828             : 
     829             : /* readline.c */
     830             : 
     831             : char**  pari_completion(pari_rl_interface *pari_rl, char *text, int START, int END);
     832             : char*   pari_completion_word(pari_rl_interface *pari_rl, long end);
     833             : char**  pari_completion_matches(pari_rl_interface *pari_rl, const char *s, long pos, long *wordpos);
     834             : 
     835             : /* rootpol.c */
     836             : 
     837             : GEN     FFT(GEN x, GEN Omega);
     838             : GEN     FFTinit(long k, long prec);
     839             : 
     840             : /* subcyclo.c */
     841             : 
     842             : GEN     bnr_to_znstar(GEN bnr, long *complex);
     843             : GEN     galoiscyclo(long n, long v);
     844             : GEN     znstar_bits(long n, GEN H);
     845             : long    znstar_conductor(GEN H);
     846             : long    znstar_conductor_bits(GEN bits);
     847             : GEN     znstar_cosets(long n, long phi_n, GEN H);
     848             : GEN     znstar_elts(long n, GEN H);
     849             : GEN     znstar_generate(long n, GEN V);
     850             : GEN     znstar_hnf(GEN Z, GEN M);
     851             : GEN     znstar_hnf_elts(GEN Z, GEN H);
     852             : GEN     znstar_hnf_generators(GEN Z, GEN M);
     853             : GEN     znstar_reduce_modulus(GEN H, long n);
     854             : GEN     znstar_small(GEN zn);
     855             : 
     856             : /* trans1.c */
     857             : 
     858             : struct abpq { GEN *a, *b, *p, *q; };
     859             : struct abpq_res { GEN P, Q, B, T; };
     860             : void    abpq_init(struct abpq *A, long n);
     861             : void    abpq_sum(struct abpq_res *r, long n1, long n2, struct abpq *A);
     862             : GEN     logagmcx(GEN q, long prec);
     863             : GEN     zellagmcx(GEN a0, GEN b0, GEN r, GEN t, long prec);
     864             : 
     865             : /* trans2.c */
     866             : 
     867             : GEN     trans_fix_arg(long *prec, GEN *s0, GEN *sig, GEN *tau, pari_sp *av, GEN *res);
     868             : 
     869             : /* trans3.c */
     870             : 
     871             : GEN     bernreal_using_zeta(long n, GEN iz, long prec);
     872             : GEN     double_eta_quotient(GEN a, GEN w, GEN D, long p, long q, GEN pq, GEN sqrtD);
     873             : GEN     inv_szeta_euler(long n, double lba, long prec);
     874             : GEN     trueE2(GEN tau, long prec);
     875             : 
     876             : /* volcano.c */
     877             : 
     878             : long j_level_in_volcano(GEN phi, ulong j, ulong p, ulong pi, long L, long depth);
     879             : ulong ascend_volcano(GEN phi, ulong j, ulong p, ulong pi, long level, long L, long depth, long steps);
     880             : ulong descend_volcano(GEN phi, ulong j, ulong p, ulong pi, long level, long L, long depth, long steps);
     881             : long next_surface_nbr(ulong *nJ, GEN phi, long L, long h, ulong J, const ulong *pJ, ulong p, ulong pi);
     882             : GEN enum_roots(ulong j, norm_eqn_t ne, GEN fdb, classgp_pcp_t G);
     883             : 
     884             : ENDEXTERN

Generated by: LCOV version 1.11