=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/pexpr.c,v retrieving revision 1.36 retrieving revision 1.43 diff -u -p -r1.36 -r1.43 --- OpenXM_contrib2/asir2000/io/pexpr.c 2004/05/14 06:02:54 1.36 +++ OpenXM_contrib2/asir2000/io/pexpr.c 2018/03/29 01:32:53 1.43 @@ -44,7 +44,7 @@ * 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/pexpr.c,v 1.35 2004/03/17 03:22:47 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/pexpr.c,v 1.42 2017/08/31 02:36:21 noro Exp $ */ #include "ca.h" #include "al.h" @@ -56,10 +56,6 @@ #define FPRINT #endif -#if defined(PARI) -#include "genpari.h" -#endif - extern int outputstyle; FILE *asir_out; @@ -72,7 +68,6 @@ int real_digit; int real_binary; int print_quote; int hideargs; -extern int asir_texmacs; extern FUNC user_print_function; #if 0 int printmode = PRINTF_E; @@ -102,11 +97,14 @@ int printmode = PRINTF_G; #define PRINTSTR printstr #define PRINTCOMP printcomp #define PRINTDP printdp +#define PRINTDPM printdpm #define PRINTUI printui #define PRINTGF2MAT printgf2mat #define PRINTGFMMAT printgfmmat #define PRINTBYTEARRAY printbytearray #define PRINTQUOTE printquote +#define PRINTQUOTEARG printquotearg +#define PRINTNBP printnbp #define PRINTERR printerr #define PRINTLF printlf #define PRINTLOP printlop @@ -129,34 +127,39 @@ int printmode = PRINTF_G; /* spetial functions for file output */ void output_init() { - OUT = stdout; - sprintf(DFORMAT,"%%0%dd",DLENGTH); + OUT = stdout; + sprintf(DFORMAT,"%%0%dd",DLENGTH); } int mmono(p) P p; { - if ( NUM(p) ) + if ( NUM(p) ) #if defined(INTERVAL) - if ( NID(p) != N_IP && NID(p) != N_IntervalDouble && NID(p) != N_IntervalQuad && NID(p) != N_IntervalBigFloat - && compnum(CO,(Num)p,0) < 0 ) + if ( NID(p) != N_IP && NID(p) != N_IntervalDouble && NID(p) != N_IntervalQuad && NID(p) != N_IntervalBigFloat + && compnum(CO,(Num)p,0) < 0 ) #else - if ( compnum(CO,(Num)p,0) < 0 ) + if ( compnum(CO,(Num)p,0) < 0 ) #endif - return ( 1 ); - else - return ( 0 ); - else if ( NEXT(DC(p)) ) - return ( 0 ); - else - return (mmono(COEF(DC(p)))); + return ( 1 ); + else + return ( 0 ); + else if ( NEXT(DC(p)) ) + return ( 0 ); + else + return (mmono(COEF(DC(p)))); } -#if defined(PARI) -void printbf(a) -BF a; +void printbf(BF a) { - sor(a->body,double_output ? 'f' : 'g',-1,0); + int dprec; + char fbuf[BUFSIZ]; + char *s; + dprec = (a->body->_mpfr_prec)*0.30103; + if ( !dprec ) dprec = 1; + sprintf(fbuf,"%%.%dR%c",dprec,double_output?'f':'g'); + mpfr_asprintf(&s,fbuf,a->body); + TAIL PUTS(s); + mpfr_free_str(s); } -#endif