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

Diff for /OpenXM_contrib2/asir2000/io/cio.c between version 1.17 and 1.21

version 1.17, 2015/08/12 10:45:12 version 1.21, 2016/03/31 05:30:32
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/cio.c,v 1.16 2015/08/06 10:01:52 fujimoto Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/cio.c,v 1.20 2015/08/18 02:26:05 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
 #include "ox.h"  #include "ox.h"
 #if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__)  #if !defined(VISUAL) && !defined(__MINGW32__)
 #include <ctype.h>  #include <ctype.h>
 #endif  #endif
   
Line 68  int valid_as_cmo(Obj obj)
Line 68  int valid_as_cmo(Obj obj)
       return 1;        return 1;
     case O_N:      case O_N:
       nid = NID((Num)obj);        nid = NID((Num)obj);
       if ( nid == N_Q || nid == N_R || nid == N_B )        if ( nid == N_Q || nid == N_R || nid == N_B || nid == N_C )
         return 1;          return 1;
       else        else
         return 0;          return 0;
Line 106  void write_cmo(FILE *s,Obj obj)
Line 106  void write_cmo(FILE *s,Obj obj)
         case N_B:          case N_B:
           write_cmo_bf(s,(BF)obj);            write_cmo_bf(s,(BF)obj);
           break;            break;
           case N_C:
             write_cmo_complex(s,(C)obj);
             break;
         default:          default:
           sprintf(errmsg, "write_cmo : number id=%d not implemented.",            sprintf(errmsg, "write_cmo : number id=%d not implemented.",
             NID((Num)obj));              NID((Num)obj));
Line 174  int cmo_tag(Obj obj,int *tag)
Line 177  int cmo_tag(Obj obj,int *tag)
           *tag = CMO_IEEE_DOUBLE_FLOAT; break;            *tag = CMO_IEEE_DOUBLE_FLOAT; break;
         case N_B:          case N_B:
           *tag = CMO_BIGFLOAT; break;            *tag = CMO_BIGFLOAT; break;
           case N_C:
             *tag = CMO_COMPLEX; break;
         default:          default:
           return 0;            return 0;
       }        }
Line 256  void write_cmo_bf(FILE *s,BF bf)
Line 261  void write_cmo_bf(FILE *s,BF bf)
   len = MPFR_LIMB_SIZE(bf->body);    len = MPFR_LIMB_SIZE(bf->body);
 #if SIZEOF_LONG == 4  #if SIZEOF_LONG == 4
   write_int(s,&len);    write_int(s,&len);
   write_intarray(s,MPFR_MANT(bf->body),len);    write_intarray(s,(int *)MPFR_MANT(bf->body),len);
 #else /* SIZEOF_LONG == 8 */  #else /* SIZEOF_LONG == 8 */
   t = 2*len;    t = (MPFR_PREC(bf->body)+31)/32;
   write_int(s,&t);    write_int(s,&t);
   write_longarray(s,MPFR_MANT(bf->body),len);    write_longarray(s,MPFR_MANT(bf->body),t);
 #endif  #endif
 }  }
   
Line 347  void write_cmo_r(FILE *s,R f)
Line 352  void write_cmo_r(FILE *s,R f)
   write_cmo(s,(Obj)DN(f));    write_cmo(s,(Obj)DN(f));
 }  }
   
   void write_cmo_complex(FILE *s,C f)
   {
     int r;
   
     r = CMO_COMPLEX; write_int(s,&r);
     write_cmo(s,(Obj)f->r);
     write_cmo(s,(Obj)f->i);
   }
   
 void write_cmo_dp(FILE *s,DP dp)  void write_cmo_dp(FILE *s,DP dp)
 {  {
   int i,n,nv,r;    int i,n,nv,r;
Line 482  void read_cmo(FILE *s,Obj *rp)
Line 496  void read_cmo(FILE *s,Obj *rp)
   N nm,dn;    N nm,dn;
   P p,pnm,pdn;    P p,pnm,pdn;
   Real real;    Real real;
     C c;
   double dbl;    double dbl;
   STRING str;    STRING str;
   USINT t;    USINT t;
Line 540  void read_cmo(FILE *s,Obj *rp)
Line 555  void read_cmo(FILE *s,Obj *rp)
     case CMO_BIGFLOAT:      case CMO_BIGFLOAT:
       read_cmo_bf(s,&bf); *rp = (Obj)bf;        read_cmo_bf(s,&bf); *rp = (Obj)bf;
       break;        break;
       case CMO_COMPLEX:
         NEWC(c);
         read_cmo(s,(Obj *)&c->r);
         read_cmo(s,(Obj *)&c->i);
         *rp = (Obj)c;
         break;
     case CMO_DISTRIBUTED_POLYNOMIAL:      case CMO_DISTRIBUTED_POLYNOMIAL:
       read_cmo_dp(s,&dp); *rp = (Obj)dp;        read_cmo_dp(s,&dp); *rp = (Obj)dp;
       break;        break;
Line 652  void read_cmo_bf(FILE *s,BF *bf)
Line 673  void read_cmo_bf(FILE *s,BF *bf)
   MPFR_SIGN(r->body) = sgn;    MPFR_SIGN(r->body) = sgn;
   MPFR_EXP(r->body) = exp;    MPFR_EXP(r->body) = exp;
 #if SIZEOF_LONG == 4  #if SIZEOF_LONG == 4
   read_intarray(s,MPFR_MANT(r->body),len);    read_intarray(s,(int *)MPFR_MANT(r->body),len);
 #else /* SIZEOF_LONG == 8 */  #else /* SIZEOF_LONG == 8 */
   read_longarray(s,MPFR_MANT(r->body),len);    read_longarray(s,MPFR_MANT(r->body),len);
 #endif  #endif
Line 737  void read_cmo_p(FILE *s,P *rp)
Line 758  void read_cmo_p(FILE *s,P *rp)
   P v,p;    P v,p;
   VL tvl,rvl;    VL tvl,rvl;
   char *name;    char *name;
     FUNC f;
   
   read_cmo(s,&obj); vlist = (LIST)obj;    read_cmo(s,&obj); vlist = (LIST)obj;
   nv = length(BDY(vlist));    nv = length(BDY(vlist));
Line 744  void read_cmo_p(FILE *s,P *rp)
Line 766  void read_cmo_p(FILE *s,P *rp)
   for ( i = 0, t = BDY(vlist); i < nv; t = NEXT(t), i++ ) {    for ( i = 0, t = BDY(vlist); i < nv; t = NEXT(t), i++ ) {
 /*    cmoname_to_localname(BDY((STRING)BDY(t)),&name); */  /*    cmoname_to_localname(BDY((STRING)BDY(t)),&name); */
     name = BDY((STRING)BDY(t));      name = BDY((STRING)BDY(t));
     makevar(name,&v); vtab[i] = VR(v);      gen_searchf_searchonly(name,&f,1);
       if ( f )
         makesrvar(f,&v);
       else
         makevar(name,&v);
       vtab[i] = VR(v);
   }    }
   remote_vtab = vtab;    remote_vtab = vtab;
   read_cmo(s,&obj); p = (P)obj;    read_cmo(s,&obj); p = (P)obj;

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

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