=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/pexpr.c,v retrieving revision 1.10 retrieving revision 1.16 diff -u -p -r1.10 -r1.16 --- OpenXM_contrib2/asir2000/io/pexpr.c 2001/03/09 01:44:10 1.10 +++ OpenXM_contrib2/asir2000/io/pexpr.c 2001/09/03 07:01:08 1.16 @@ -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.9 2000/12/22 10:03:30 saito Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/pexpr.c,v 1.15 2001/08/28 05:46:26 noro Exp $ */ #include "ca.h" #include "al.h" @@ -66,6 +66,7 @@ int hex_output; int fortran_output; int double_output; int real_digit; +int print_quote; #define TAIL #define PUTS(s) fputs(s,OUT) @@ -90,6 +91,7 @@ int real_digit; #define PRINTGF2MAT printgf2mat #define PRINTGFMMAT printgfmmat #define PRINTBYTEARRAY printbytearray +#define PRINTQUOTE printquote #define PRINTERR printerr #define PRINTLF printlf #define PRINTLOP printlop @@ -97,6 +99,8 @@ int real_digit; #define PRINTEOP printeop #define PRINTQOP printqop #define PRINTUP printup +#define PRINTUM printum +#define PRINTSF printsf #endif #ifdef SPRINT @@ -105,6 +109,9 @@ static char *buf; extern char DFORMAT[BUFSIZ]; extern int hex_output; extern int fortran_output; +extern int double_output; +extern int real_digit; +extern int print_quote; #define TAIL while ( *OUT ) OUT++; #define PUTS(s) strcat(OUT,s) @@ -129,6 +136,7 @@ extern int fortran_output; #define PRINTGF2MAT sprintgf2mat #define PRINTGFMMAT sprintgfmmat #define PRINTBYTEARRAY sprintbytearray +#define PRINTQUOTE sprintquote #define PRINTERR sprinterr #define PRINTLF sprintlf #define PRINTLOP sprintlop @@ -136,6 +144,8 @@ extern int fortran_output; #define PRINTEOP sprinteop #define PRINTQOP sprintqop #define PRINTUP sprintup +#define PRINTUM sprintum +#define PRINTSF sprintsf #endif void PRINTEXPR(); @@ -154,6 +164,7 @@ void PRINTUI(); void PRINTGF2MAT(); void PRINTGFMMAT(); void PRINTBYTEARRAY(); +void PRINTQUOTE(); void PRINTERR(); void PRINTCPLX(); void PRINTLM(); @@ -270,6 +281,8 @@ Obj p; PRINTGFMMAT(vl,(GFMMAT)p); break; case O_BYTEARRAY: PRINTBYTEARRAY(vl,(BYTEARRAY)p); break; + case O_QUOTE: + PRINTQUOTE(vl,(QUOTE)p); break; default: break; } @@ -306,6 +319,7 @@ N n; } } +#if defined(FPRINT) #if defined(ITVDEBUG) void printbin(double z) { @@ -327,12 +341,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; @@ -428,6 +447,12 @@ Num q; case N_GFPN: PRINTUP((UP)(((GFPN)q)->body)); break; + case N_GFS: + TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); + break; + case N_GFSN: + PRINTUM(BDY((GFSN)q)); + break; } } @@ -744,6 +769,20 @@ BYTEARRAY array; PUTS("|"); } +void PRINTQUOTE(vl,quote) +VL vl; +QUOTE quote; +{ + LIST list; + + if ( print_quote ) { + fnodetotree(BDY(quote),&list); + PRINTEXPR(vl,(Obj)list); + } else { + PUTS("<...quoted...>"); + } +} + void PRINTERR(vl,e) VL vl; ERR e; @@ -920,5 +959,49 @@ UP n; } } PUTS(")"); + } +} + +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(")"); + } +} + +PRINTSF(i) +unsigned int i; +{ + if ( !i ) { + PUTS("0"); + } else { + TAIL PRINTF(OUT,"@_%d",IFTOF(i)); } }