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

Diff for /OpenXM_contrib2/asir2000/io/bsave.c between version 1.12 and 1.17

version 1.12, 2003/02/14 22:29:15 version 1.17, 2015/08/04 06:20:45
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/bsave.c,v 1.11 2002/01/08 04:14:38 kondoh Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/bsave.c,v 1.16 2009/03/16 16:43:03 ohara Exp $
 */  */
 /* saveXXX must not use GC_malloc(), GC_malloc_atomic(). */  /* saveXXX must not use GC_malloc(), GC_malloc_atomic(). */
   
Line 52 
Line 52 
 #include "parse.h"  #include "parse.h"
 #include "com.h"  #include "com.h"
   
 #if defined(PARI)  void savenbp(FILE *s,NBP p);
 #include "genpari.h"  
 int get_lg(GEN);  
 #endif  
   
 void (*savef[])() = { 0, savenum, savep, saver, savelist, savevect,  void (*savef[])() = { 0, savenum, savep, saver, savelist, savevect,
         savemat, savestring, 0, savedp, saveui, saveerror,0,0,0,savegfmmat, savebytearray };          savemat, savestring, 0, savedp, saveui, saveerror,0,0,0,savegfmmat,
           savebytearray, 0, 0, 0, 0, 0, 0, 0, 0,  savenbp };
 #if defined(INTERVAL)  #if defined(INTERVAL)
 void saveitv();  void saveitv();
 void saveitvd();  void saveitvd();
 void (*nsavef[])() = { saveq, savereal, 0, savebf, saveitv, saveitvd, 0, saveitv, savecplx ,savemi, savelm, savegf2n, savegfpn, savegfs, savegfsn};  void (*nsavef[])() = { saveq, savereal, 0, savebf, saveitv, saveitvd, 0, saveitv, savecplx ,savemi, savelm, savegf2n, savegfpn, savegfs, savegfsn,savedalg};
 #else  #else
 void (*nsavef[])() = { saveq, savereal, 0, savebf, savecplx ,savemi, savelm, savegf2n, savegfpn, savegfs, savegfsn};  void (*nsavef[])() = { saveq, savereal, 0, savebf, savecplx ,savemi, savelm, savegf2n, savegfpn, savegfs, savegfsn,savedalg};
 #endif  #endif
   
 static short zeroval = 0;  static short zeroval = 0;
Line 112  void savereal(FILE *s,Real p)
Line 110  void savereal(FILE *s,Real p)
   
 void savebf(FILE *s,BF p)  void savebf(FILE *s,BF p)
 {  {
 #if defined(PARI)    unsigned int zero = 0;
         GEN z;    unsigned int prec;
         int sign;          L exp;
         unsigned long expo;    int sgn,len,t;
         unsigned int len;  
   
         z = (GEN)BDY(p);    prec = MPFR_PREC(p->body);
         sign = signe(z);    exp = MPFR_EXP(p->body);
         len = lg(z)-2;    sgn = MPFR_SIGN(p->body);
         expo = expo(z);          len = MPFR_LIMB_SIZE(p->body);
   
         write_int(s,&sign);          write_int(s,&sgn);
           write_int(s,(int *)&prec);
 #if defined(LONG_IS_32BIT)          write_int64(s,(UL *)&exp);
         write_int(s,(int *)&zeroval); /* expo>>32 is always 0 */  #if SIZEOF_LONG == 4
         write_int(s,(int *)&expo);  
         write_int(s,&len);          write_int(s,&len);
         write_intarray(s,(int *)&z[2],len);          write_intarray(s,p->body->_mpfr_d,len);
 #elif defined(LONG_IS_64BIT)  #else /* SIZEOF_LONG == 8 */
         t = expo>>32; write_int(s,(int *)&t);          t = 2*len;
         t = expo&0xffffffff; write_int(s,&t);          write_int(s,&t);
         t = 2*len; write_int(s,&t);          write_longarray(s,p->body->_mpfr_d,len);
         write_longarray(s,&z[2],len);  
 #endif  #endif
 #else  
         error("savebf : PARI is not combined");  
 #endif  
 }  }
   
 #if defined(INTERVAL)  #if defined(INTERVAL)
Line 201  void savegfsn(FILE *s,GFSN p)
Line 193  void savegfsn(FILE *s,GFSN p)
         write_intarray(s,COEF(BDY(p)),d+1);          write_intarray(s,COEF(BDY(p)),d+1);
 }  }
   
   void savedalg(FILE *s,DAlg p)
   {
           saveobj(s,(Obj)p->nm);
           saveobj(s,(Obj)p->dn);
   }
   
 void savep(FILE *s,P p)  void savep(FILE *s,P p)
 {  {
         DCP dc;          DCP dc;
Line 338  void savebytearray(FILE *s,BYTEARRAY p)
Line 336  void savebytearray(FILE *s,BYTEARRAY p)
 {  {
         write_short(s,&OID(p)); write_int(s,&p->len);          write_short(s,&OID(p)); write_int(s,&p->len);
         write_string(s,p->body,p->len);          write_string(s,p->body,p->len);
   }
   
   void savenbp(FILE *s,NBP p)
   {
           int i,n;
           NODE t;
           NBM m;
   
           write_short(s,&OID(p));
           for ( n = 0, t = BDY(p); t; t = NEXT(t), n++ );
           write_int(s,&n);
           for ( i = 0, t = BDY(p); i < n; t = NEXT(t), i++ ) {
                   m = (NBM)BDY(t);
                   saveobj(s,(Obj)m->c);
                   write_int(s,&m->d);
                   write_intarray(s,m->b,(m->d+31)/32);
           }
 }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.17

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