[BACK]Return to spexpr.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / io

Diff for /OpenXM_contrib2/asir2000/io/spexpr.c between version 1.13 and 1.16

version 1.13, 2001/04/20 02:34:23 version 1.16, 2001/09/03 07:01:09
Line 44 
Line 44 
  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY   * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  * $OpenXM: OpenXM_contrib2/asir2000/io/spexpr.c,v 1.12 2001/03/15 05:52:12 noro Exp $   * $OpenXM$
 */  */
 #include "ca.h"  #include "ca.h"
 #include "al.h"  #include "al.h"
Line 64  FILE *asir_out;
Line 64  FILE *asir_out;
 char DFORMAT[BUFSIZ];  char DFORMAT[BUFSIZ];
 int hex_output;  int hex_output;
 int fortran_output;  int fortran_output;
   int double_output;
   int real_digit;
   int print_quote;
   
 #define TAIL  #define TAIL
 #define PUTS(s) fputs(s,OUT)  #define PUTS(s) fputs(s,OUT)
Line 96  int fortran_output;
Line 99  int fortran_output;
 #define PRINTEOP printeop  #define PRINTEOP printeop
 #define PRINTQOP printqop  #define PRINTQOP printqop
 #define PRINTUP printup  #define PRINTUP printup
   #define PRINTUM printum
   #define PRINTSF printsf
 #endif  #endif
   
 #ifdef SPRINT  #ifdef SPRINT
Line 106  extern int hex_output;
Line 111  extern int hex_output;
 extern int fortran_output;  extern int fortran_output;
 extern int double_output;  extern int double_output;
 extern int real_digit;  extern int real_digit;
   extern int print_quote;
   
 #define TAIL while ( *OUT ) OUT++;  #define TAIL while ( *OUT ) OUT++;
 #define PUTS(s) strcat(OUT,s)  #define PUTS(s) strcat(OUT,s)
Line 138  extern int real_digit;
Line 144  extern int real_digit;
 #define PRINTEOP sprinteop  #define PRINTEOP sprinteop
 #define PRINTQOP sprintqop  #define PRINTQOP sprintqop
 #define PRINTUP sprintup  #define PRINTUP sprintup
   #define PRINTUM sprintum
   #define PRINTSF sprintsf
 #endif  #endif
   
 void PRINTEXPR();  void PRINTEXPR();
Line 174  P p;
Line 182  P p;
 {  {
         if ( NUM(p) )          if ( NUM(p) )
 #if defined(INTERVAL)  #if defined(INTERVAL)
                 if ( NID(p) != N_IP && compnum(CO,(Num)p,0) < 0 )                  if ( NID(p) != N_IP && NID(p) != N_ID && NID(p) != N_IT && NID(p) != N_IF
                           && compnum(CO,(Num)p,0) < 0 )
 #else  #else
                 if ( compnum(CO,(Num)p,0) < 0 )                  if ( compnum(CO,(Num)p,0) < 0 )
 #endif  #endif
Line 310  N n;
Line 319  N n;
         }          }
 }  }
   
 extern int      printmode;  #if defined(FPRINT)
   #if defined(ITVDEBUG)
   void printbin(double z)
   {
           int     i, j, mask;
           union {
                   double  x;
                   char    c[8];
           } a;
   
           a.x = z;
           for(i=7;i>=0;i--) {
                   mask = 0x80;
                   for(j=0;j<8;j++) {
                           if (a.c[i] & mask) fprintf(stderr,"1");
                           else fprintf(stderr,"0");
                           mask >>= 1;
                   }
           }
           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)  void PRINTNUM(q)
 Num q;  Num q;
 {  {
Line 336  Num q;
Line 377  Num q;
 #if defined(INTERVAL)  #if defined(INTERVAL)
                                 case MID_PRINTF_E:                                  case MID_PRINTF_E:
 #endif  #endif
                                         TAIL PRINTF(OUT,"%.15e",BDY((Real)q));                                          TAIL PRINTF(OUT,"%.16e",BDY((Real)q));
                                         break;                                          break;
                                 case PRINTF_G:                                  case PRINTF_G:
 #if defined(INTERVAL)  #if defined(INTERVAL)
                                 case MID_PRINTF_G:                                  case MID_PRINTF_G:
 #endif  #endif
                                 default:                                  default:
                                 if ( real_digit ) {                                          if ( real_digit ) {
                                         sprintf(real_format,                                                  sprintf(real_format,
                                                 double_output?"%%.%df":"%%.%dg",real_digit);                                                          double_output?"%%.%df":"%%.%dg",real_digit);
                                         TAIL PRINTF(OUT,real_format,BDY((Real)q));                                                  TAIL PRINTF(OUT,real_format,BDY((Real)q));
                                 } else {                                          } else {
                                         TAIL PRINTF(OUT,double_output?"%f":"%g",BDY((Real)q));                                                  TAIL PRINTF(OUT,double_output?"%f":"%g",BDY((Real)q));
                                 }                                          }
                                 break;                                          break;
                         }                          }
                         break;                          break;
                 case N_A:                  case N_A:
Line 407  Num q;
Line 448  Num q;
                         PRINTUP((UP)(((GFPN)q)->body));                          PRINTUP((UP)(((GFPN)q)->body));
                         break;                          break;
                 case N_GFS:                  case N_GFS:
                         TAIL PRINTF(OUT,"@_%d",CONT((GFS)q)); break;                          TAIL PRINTF(OUT,"@_%d",CONT((GFS)q));
                           break;
                   case N_GFSN:
                           PRINTUM(BDY((GFSN)q));
                           break;
         }          }
 }  }
   
Line 418  C a;
Line 463  C a;
         if ( a->r )          if ( a->r )
                 PRINTNUM(a->r);                  PRINTNUM(a->r);
         if ( a->i ) {          if ( a->i ) {
   #if defined(INTERVAL)
                   if ( a->r && ((compnum(0,a->i,0) > 0)
                           || NID(a->i) == N_IP || NID(a->i) == N_ID
                           || NID(a->i) == N_IT || NID(a->i) == N_IF) )
   #else
                 if ( a->r && (compnum(0,a->i,0) > 0) )                  if ( a->r && (compnum(0,a->i,0) > 0) )
   #endif
                         PUTS("+");                          PUTS("+");
                 PRINTNUM(a->i); PUTS("*@i");                  PRINTNUM(a->i); PUTS("*@i");
         }          }
Line 722  void PRINTQUOTE(vl,quote)
Line 773  void PRINTQUOTE(vl,quote)
 VL vl;  VL vl;
 QUOTE quote;  QUOTE quote;
 {  {
         PUTS("<...quoted...>");          LIST list;
   
           if ( print_quote ) {
                   fnodetotree(BDY(quote),&list);
                   PRINTEXPR(vl,(Obj)list);
           } else {
                   PUTS("<...quoted...>");
           }
 }  }
   
 void PRINTERR(vl,e)  void PRINTERR(vl,e)
Line 901  UP n;
Line 959  UP n;
                         }                          }
                 }                  }
                 PUTS(")");                  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));
         }          }
 }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.16

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>