=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/pexpr.c,v retrieving revision 1.9 retrieving revision 1.15 diff -u -p -r1.9 -r1.15 --- OpenXM_contrib2/asir2000/io/pexpr.c 2000/12/22 10:03:30 1.9 +++ OpenXM_contrib2/asir2000/io/pexpr.c 2001/08/28 05:46:26 1.15 @@ -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.8 2000/12/16 06:16:10 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/pexpr.c,v 1.14 2001/08/06 01:48:33 noro Exp $ */ #include "ca.h" #include "al.h" @@ -65,6 +65,8 @@ char DFORMAT[BUFSIZ]; int hex_output; int fortran_output; int double_output; +int real_digit; +int print_quote; #define TAIL #define PUTS(s) fputs(s,OUT) @@ -89,6 +91,7 @@ int double_output; #define PRINTGF2MAT printgf2mat #define PRINTGFMMAT printgfmmat #define PRINTBYTEARRAY printbytearray +#define PRINTQUOTE printquote #define PRINTERR printerr #define PRINTLF printlf #define PRINTLOP printlop @@ -104,6 +107,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) @@ -128,6 +134,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 @@ -153,6 +160,7 @@ void PRINTUI(); void PRINTGF2MAT(); void PRINTGFMMAT(); void PRINTBYTEARRAY(); +void PRINTQUOTE(); void PRINTERR(); void PRINTCPLX(); void PRINTLM(); @@ -269,6 +277,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; } @@ -305,6 +315,7 @@ N n; } } +#if defined(FPRINT) #if defined(ITVDEBUG) void printbin(double z) { @@ -326,16 +337,23 @@ 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; { + char real_format[20]; + if ( !q ) { PUTS("0"); return; @@ -362,7 +380,13 @@ Num q; case MID_PRINTF_G: #endif default: - TAIL PRINTF(OUT,"%g",BDY((Real)q)); + if ( real_digit ) { + sprintf(real_format, + double_output?"%%.%df":"%%.%dg",real_digit); + TAIL PRINTF(OUT,real_format,BDY((Real)q)); + } else { + TAIL PRINTF(OUT,double_output?"%f":"%g",BDY((Real)q)); + } break; } break; @@ -419,6 +443,9 @@ Num q; case N_GFPN: PRINTUP((UP)(((GFPN)q)->body)); break; + case N_GFS: + TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); + break; } } @@ -733,6 +760,20 @@ BYTEARRAY array; } TAIL PRINTF(OUT,"%02x",(unsigned int)b[i]); 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)