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

Diff for /OpenXM_contrib2/asir2000/io/biovar.c between version 1.1.1.1 and 1.6

version 1.1.1.1, 1999/12/03 07:39:11 version 1.6, 2018/03/29 01:32:53
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/asir99/io/biovar.c,v 1.1.1.1 1999/11/10 08:12:30 noro Exp $ */  /*
    * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
    * All rights reserved.
    *
    * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
    * non-exclusive and royalty-free license to use, copy, modify and
    * redistribute, solely for non-commercial and non-profit purposes, the
    * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
    * conditions of this Agreement. For the avoidance of doubt, you acquire
    * only a limited right to use the SOFTWARE hereunder, and FLL or any
    * third party developer retains all rights, including but not limited to
    * copyrights, in and to the SOFTWARE.
    *
    * (1) FLL does not grant you a license in any way for commercial
    * purposes. You may use the SOFTWARE only for non-commercial and
    * non-profit purposes only, such as academic, research and internal
    * business use.
    * (2) The SOFTWARE is protected by the Copyright Law of Japan and
    * international copyright treaties. If you make copies of the SOFTWARE,
    * with or without modification, as permitted hereunder, you shall affix
    * to all such copies of the SOFTWARE the above copyright notice.
    * (3) An explicit reference to this SOFTWARE and its copyright owner
    * shall be made on your publication or presentation in any form of the
    * results obtained by use of the SOFTWARE.
    * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
    * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
    * for such modification or the source code of the modified part of the
    * SOFTWARE.
    *
    * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
    * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
    * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
    * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
    * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
    * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
    * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
    * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
    * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
    * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
    * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
    * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
    * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
    * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
    * 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/biovar.c,v 1.5 2016/03/31 05:30:32 noro Exp $
   */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
 #include "ox.h"  #include "ox.h"
Line 10  void savevl(s,vl)
Line 57  void savevl(s,vl)
 FILE *s;  FILE *s;
 VL vl;  VL vl;
 {  {
         int n,i;    int n,i;
         VL tvl;    VL tvl;
   
         for ( tvl = vl, n = 0; tvl; tvl = NEXT(tvl))    for ( tvl = vl, n = 0; tvl; tvl = NEXT(tvl))
                 if ( tvl->v->attr != (pointer)V_UC && tvl->v->attr != (pointer)V_PF )      if ( tvl->v->attr != (pointer)V_UC && tvl->v->attr != (pointer)V_PF )
                         n++;        n++;
         write_int(s,&n);    write_int(s,&n);
         vtab = (V *)CALLOC(n,sizeof(V));    vtab = (V *)CALLOC(n,sizeof(V));
         for ( tvl = vl, i = 0; i < n; tvl = NEXT(tvl) )    for ( tvl = vl, i = 0; i < n; tvl = NEXT(tvl) )
                 if ( tvl->v->attr != (pointer)V_UC && tvl->v->attr != (pointer)V_PF ) {      if ( tvl->v->attr != (pointer)V_UC && tvl->v->attr != (pointer)V_PF ) {
                         vtab[i] = tvl->v; savev(s,vtab[i]); i++;        vtab[i] = tvl->v; savev(s,vtab[i]); i++;
                 }      }
 }  }
   
 void loadvl(s)  void loadvl(s)
 FILE *s;  FILE *s;
 {  {
         int n,i,need_reorder;    int n,i,need_reorder;
         V v1,v2;    V v1,v2;
         VL t,t1;    VL t,t1;
   
         read_int(s,&n);    read_int(s,&n);
         vtab = (V *)CALLOC(n,sizeof(V));    vtab = (V *)CALLOC(n,sizeof(V));
         for ( i = 0; i < n; i++ )    for ( i = 0; i < n; i++ )
                 loadv(s,&vtab[i]);      loadv(s,&vtab[i]);
         need_reorder = 0;    need_reorder = 0;
         for ( i = 0; i < n-1; i++ ) {    for ( i = 0; i < n-1; i++ ) {
                 v1 = vtab[i]; v2 = vtab[i+1];      v1 = vtab[i]; v2 = vtab[i+1];
                 for ( t = CO; t->v != v1 && t->v != v2; t = NEXT(t) );      for ( t = CO; t->v != v1 && t->v != v2; t = NEXT(t) );
                 if ( t->v == v2 ) {      if ( t->v == v2 ) {
                         need_reorder = 1; break;        need_reorder = 1; break;
                 }      }
         }    }
         if ( need_reorder ) {    if ( need_reorder ) {
                 for ( i = n-1, t = 0; i >= 0; i-- ) {      for ( i = n-1, t = 0; i >= 0; i-- ) {
                         NEWVL(t1); t1->v = vtab[i]; NEXT(t1) = t; t = t1;        NEWVL(t1); t1->v = vtab[i]; NEXT(t1) = t; t = t1;
                 }      }
                 file_vl = t;      file_vl = t;
         } else    } else
                 file_vl = 0;      file_vl = 0;
 }  }
   
 void skipvl(s)  void skipvl(s)
 FILE *s;  FILE *s;
 {  {
         int n,i,size,len;    int n,i,size,len;
   
         read_int(s,&n);    read_int(s,&n);
         for ( i = 0, size = 0; i < n; i++ ) {    for ( i = 0, size = 0; i < n; i++ ) {
                 read_int(s,&len); size += len;      read_int(s,&len); size += len;
         }    }
         fseek(s,size,1L);    fseek(s,size,1L);
 }  }
   
 void savev(s,v)  void savev(s,v)
 FILE *s;  FILE *s;
 V v;  V v;
 {  {
         savestr(s,NAME(v));    savestr(s,NAME(v));
 }  }
   
 void loadv(s,vp)  void loadv(s,vp)
 FILE *s;  FILE *s;
 V *vp;  V *vp;
 {  {
         P p;    P p;
         char *name;    char *name;
   
         loadstr(s,&name);    loadstr(s,&name);
         if ( name ) {    if ( name ) {
                 makevar(name,&p);      FUNC f;
                 *vp = VR(p);  
         } else      gen_searchf_searchonly(name,&f,1);
                 *vp = 0;      if ( f )
         makesrvar(f,&p);
       else
         makevar(name,&p);
       *vp = VR(p);
     } else
       *vp = 0;
 }  }
   
 int save_convv(v)  int save_convv(v)
 V v;  V v;
 {  {
         int i;    int i;
   
         if ( ox_do_count )    if ( ox_do_count )
                 return 0;      return 0;
         if ( v->attr == (pointer)V_PF )    if ( v->attr == (pointer)V_PF )
                 return -1;      return -1;
         for ( i = 0; vtab[i]; i++ )    for ( i = 0; vtab[i]; i++ )
                 if ( vtab[i] == v )      if ( vtab[i] == v )
                         return i;        return i;
     error("save_convv : cannot happen");
     /* NOTREACHED */
       return -1;
 }  }
   
 V load_convv(vindex)  V load_convv(vindex)
 int vindex;  int vindex;
 {  {
         return vtab[vindex];    return vtab[vindex];
 }  }
   
 void swap_bytes(ptr,unit,size)  void swap_bytes(ptr,unit,size)
 char *ptr;  char *ptr;
 int unit,size;  int unit,size;
 {  {
         char *p;    char *p;
         int i,j,hunit;    int i,j,hunit;
         char t;    char t;
   
         for ( i = 0, p = ptr, hunit = unit/2; i < size; i++, p += unit )    for ( i = 0, p = ptr, hunit = unit/2; i < size; i++, p += unit )
                 for ( j = 0; j < hunit; j++ ) {      for ( j = 0; j < hunit; j++ ) {
                         t = p[j]; p[j] = p[unit-j-1]; p[unit-j-1] = t;        t = p[j]; p[j] = p[unit-j-1]; p[unit-j-1] = t;
                 }      }
 }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.6

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