=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/pexpr.c,v retrieving revision 1.14 retrieving revision 1.17 diff -u -p -r1.14 -r1.17 --- OpenXM_contrib2/asir2000/io/pexpr.c 2001/08/06 01:48:33 1.14 +++ OpenXM_contrib2/asir2000/io/pexpr.c 2001/10/09 01:36:21 1.17 @@ -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.13 2001/04/20 02:34:23 noro Exp $ + * $OpenXM$ */ #include "ca.h" #include "al.h" @@ -99,6 +99,8 @@ int print_quote; #define PRINTEOP printeop #define PRINTQOP printqop #define PRINTUP printup +#define PRINTUM printum +#define PRINTSF printsf #endif #ifdef SPRINT @@ -142,6 +144,8 @@ extern int print_quote; #define PRINTEOP sprinteop #define PRINTQOP sprintqop #define PRINTUP sprintup +#define PRINTUM sprintum +#define PRINTSF sprintsf #endif void PRINTEXPR(); @@ -166,6 +170,13 @@ void PRINTCPLX(); void PRINTLM(); void PRINTLF(); void PRINTUP2(); +void PRINTUP(); +void PRINTUM(); +void PRINTFOP(); +void PRINTEOP(); +void PRINTLOP(); +void PRINTQOP(); +void PRINTSF(); #ifdef FPRINT void output_init() { @@ -196,6 +207,8 @@ P p; void printbf(a) BF a; { + void sor(); + sor(a->body,double_output ? 'f' : 'g',-1,0); } #endif @@ -315,6 +328,7 @@ N n; } } +#if defined(FPRINT) #if defined(ITVDEBUG) void printbin(double z) { @@ -336,12 +350,17 @@ void printbin(double z) fprintf(stderr,"\n"); } #endif +#endif +#if defined(FPRINT) #if 0 int printmode = PRINTF_E; #else int printmode = PRINTF_G; #endif +#else +extern int printmode; +#endif void PRINTNUM(q) Num q; @@ -440,6 +459,9 @@ Num q; case N_GFS: TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); break; + case N_GFSN: + PRINTUM(BDY((GFSN)q)); + break; } } @@ -723,7 +745,6 @@ VL vl; GFMMAT mat; { int row,col,i,j; - unsigned int t; unsigned int **b; row = mat->row; @@ -743,7 +764,6 @@ VL vl; BYTEARRAY array; { int len,i; - unsigned int t; unsigned char *b; len = array->len; @@ -836,7 +856,7 @@ F f; } } -PRINTFOP(vl,f) +void PRINTFOP(vl,f) VL vl; F f; { @@ -851,7 +871,7 @@ F f; } } -PRINTEOP(vl,f) +void PRINTEOP(vl,f) VL vl; F f; { @@ -878,7 +898,7 @@ F f; PUTS(")"); } -PRINTLOP(vl,f) +void PRINTLOP(vl,f) VL vl; F f; { @@ -904,7 +924,7 @@ F f; PRINTEXPR(vl,(Obj)FPL(f)); PUTS(op); PUTS("0"); } -PRINTQOP(vl,f) +void PRINTQOP(vl,f) VL vl; F f; { @@ -915,7 +935,7 @@ F f; PRINTEXPR(vl,(Obj)FQMAT(f)); PUTS(")"); } -PRINTUP(n) +void PRINTUP(n) UP n; { int i,d; @@ -946,5 +966,49 @@ UP n; } } PUTS(")"); + } +} + +void PRINTUM(n) +UM n; +{ + int i,d; + + if ( !n ) + PUTS("0"); + else if ( !n->d ) + PRINTSF(n->c[0]); + else { + d = n->d; + PUTS("("); + if ( !d ) { + PRINTSF(n->c[d]); + } else if ( d == 1 ) { + PRINTSF(n->c[d]); + PUTS("*@s"); + } else { + PRINTSF(n->c[d]); + PUTS("*@s"); PRINTHAT; TAIL PRINTF(OUT,"%d",d); + } + for ( i = d-1; i >= 0; i-- ) { + if ( n->c[i] ) { + PUTS("+("); PRINTSF(n->c[i]); PUTS(")"); + if ( i >= 2 ) { + PUTS("*@s"); PRINTHAT; TAIL PRINTF(OUT,"%d",i); + } else if ( i == 1 ) + PUTS("*@s"); + } + } + PUTS(")"); + } +} + +void PRINTSF(i) +unsigned int i; +{ + if ( !i ) { + PUTS("0"); + } else { + TAIL PRINTF(OUT,"@_%d",IFTOF(i)); } }