=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/cpexpr.c,v retrieving revision 1.26 retrieving revision 1.28 diff -u -p -r1.26 -r1.28 --- OpenXM_contrib2/asir2000/io/cpexpr.c 2006/08/27 22:17:28 1.26 +++ OpenXM_contrib2/asir2000/io/cpexpr.c 2017/08/31 02:36:21 1.28 @@ -44,15 +44,12 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/cpexpr.c,v 1.25 2005/11/16 23:42:54 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/cpexpr.c,v 1.27 2015/08/04 06:20:45 noro Exp $ */ #include "ca.h" #include "parse.h" #include "al.h" #include "base.h" -#if PARI -#include "genpari.h" -#endif #ifndef CPRINT #define CPRINT @@ -80,6 +77,7 @@ static int total_length; #define PRINTSTR length_str #define PRINTCOMP length_comp #define PRINTDP length_dp +#define PRINTDPM length_dpm #define PRINTUI length_ui #define PRINTGF2MAT length_gf2mat #define PRINTGFMMAT length_gfmmat @@ -117,22 +115,18 @@ int estimate_length(VL vl,pointer p) return total_length; } -#if defined(PARI) void PRINTBF(BF a) { char *str; - char *GENtostr0(); - void myoutbrute(); + int dprec; + char fbuf[BUFSIZ]; - if ( double_output ) { - str = GENtostr0(a->body,myoutbrute); - } else { - str = GENtostr(a->body); - } + dprec = a->body->_mpfr_prec*0.30103; + sprintf(fbuf,"%%.%dR%c",dprec,double_output?'f':'g'); + mpfr_asprintf(&str,fbuf,a->body); total_length += strlen(str); - free(str); + mpfr_free_str(str); } -#endif void PRINTNUM(Num q) { @@ -162,10 +156,8 @@ void PRINTNUM(Num q) case N_A: PUTS("("); PRINTR(ALG,(R)BDY((Alg)q)); PUTS(")"); break; -#if defined(PARI) case N_B: PRINTBF((BF)q); break; -#endif case N_C: PRINTCPLX((C)q); break; case N_M: @@ -303,6 +295,26 @@ void PRINTDP(VL vl,DP d) PUTS("+"); } } + +void PRINTDPM(VL vl,DPM d) +{ + int n,i; + DMM m; + DL dl; + + for ( n = d->nv, m = BDY(d); m; m = NEXT(m) ) { + PUTS("("); PRINTEXPR(vl,(pointer)m->c); PUTS(")*<<"); + for ( i = 0, dl = m->dl; i < n-1; i++ ) { + total_length += 11; + } + total_length += 10; + total_length += 11; /* for ':pos' */ + PUTS(">>"); + if ( NEXT(m) ) + PUTS("+"); + } +} + void PRINTUI(VL vl,USINT u) {