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

Diff for /OpenXM_contrib2/asir2000/builtin/array.c between version 1.56 and 1.59

version 1.56, 2007/11/23 05:43:23 version 1.59, 2009/03/25 07:06:30
Line 45 
Line 45 
  * 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/builtin/array.c,v 1.55 2006/10/26 10:49:16 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.58 2009/03/03 10:04:10 ohara Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "base.h"  #include "base.h"
Line 54 
Line 54 
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
   #if !defined(_MSC_VER)
 #include <unistd.h>  #include <unistd.h>
   #endif
   
 #define F4_INTRAT_PERIOD 8  #define F4_INTRAT_PERIOD 8
   
Line 95  void Pmat();
Line 97  void Pmat();
 void Pmatc();  void Pmatc();
 void Pnd_det();  void Pnd_det();
 void Plu_mat();  void Plu_mat();
   void Pmat_col();
   
 struct ftab array_tab[] = {  struct ftab array_tab[] = {
         {"lu_mat",Plu_mat,1},          {"lu_mat",Plu_mat,1},
Line 140  struct ftab array_tab[] = {
Line 143  struct ftab array_tab[] = {
         {"nbpoly_up2",Pnbpoly_up2,2},          {"nbpoly_up2",Pnbpoly_up2,2},
         {"mat_swap_row_destructive",Pmat_swap_row_destructive,3},          {"mat_swap_row_destructive",Pmat_swap_row_destructive,3},
         {"mat_swap_col_destructive",Pmat_swap_col_destructive,3},          {"mat_swap_col_destructive",Pmat_swap_col_destructive,3},
           {"mat_col",Pmat_col,2},
         {0,0,0},          {0,0,0},
 };  };
   
Line 459  void Pnewbytearray(NODE arg,BYTEARRAY *rp)
Line 463  void Pnewbytearray(NODE arg,BYTEARRAY *rp)
   
         ac = argc(arg);          ac = argc(arg);
         if ( ac == 1 ) {          if ( ac == 1 ) {
                 /* ARG0(arg) must be a filename */                  if ( !OID((Obj)ARG0(arg)) ) error("newbytearray : invalid argument");
                 asir_assert(ARG0(arg),O_STR,"newbytearray");                  switch ( OID((Obj)ARG0(arg)) ) {
                 fname = BDY((STRING)ARG0(arg));                          case O_STR:
                 fp = fopen(fname,"rb");                                  fname = BDY((STRING)ARG0(arg));
                 if ( !fp ) error("newbytearray : fopen failed");                                  fp = fopen(fname,"rb");
                 if ( stat(fname,&sbuf) < 0 ) error("newbytearray : stat failed");                                  if ( !fp ) error("newbytearray : fopen failed");
                 len = sbuf.st_size;                                  if ( stat(fname,&sbuf) < 0 )
                 MKBYTEARRAY(array,len);                                          error("newbytearray : stat failed");
                 fread(BDY(array),len,sizeof(char),fp);                                  len = sbuf.st_size;
                                   MKBYTEARRAY(array,len);
                                   fread(BDY(array),len,sizeof(char),fp);
                                   break;
                           case O_N:
                                   if ( !RATN(ARG0(arg)) )
                                           error("newbytearray : invalid argument");
                                   len = QTOS((Q)ARG0(arg));
                                   if ( len < 0 )
                                           error("newbytearray : invalid size");
                                   MKBYTEARRAY(array,len);
                                   break;
                           default:
                                   error("newbytearray : invalid argument");
                   }
         } else if ( ac == 2 ) {          } else if ( ac == 2 ) {
                 asir_assert(ARG0(arg),O_N,"newbytearray");                  asir_assert(ARG0(arg),O_N,"newbytearray");
                 len = QTOS((Q)ARG0(arg));                  len = QTOS((Q)ARG0(arg));
Line 2062  void red_by_compress(int m,unsigned int *p,unsigned in
Line 2080  void red_by_compress(int m,unsigned int *p,unsigned in
   
 void red_by_vect(int m,unsigned int *p,unsigned int *r,unsigned int hc,int len)  void red_by_vect(int m,unsigned int *p,unsigned int *r,unsigned int hc,int len)
 {  {
         register unsigned int up,lo;          unsigned int up,lo,dmy;
         unsigned int dmy;  
   
         *p++ = 0; r++; len--;          *p++ = 0; r++; len--;
         for ( ; len; len--, r++, p++ )          for ( ; len; len--, r++, p++ )
Line 3437  void Pnd_det(NODE arg,P *rp)
Line 3454  void Pnd_det(NODE arg,P *rp)
                 nd_det(0,ARG0(arg),rp);                  nd_det(0,ARG0(arg),rp);
         else          else
                 nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp);                  nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp);
   }
   
   void Pmat_col(NODE arg,P *rp)
   {
           int i,j,n;
           pointer t;
           MAT mat;
           VECT vect;
   
           asir_assert(ARG0(arg),O_MAT,"mat_col");
           asir_assert(ARG1(arg),O_N,"mat_col");
           mat = (MAT)ARG0(arg);
           j = QTOS((Q)ARG1(arg));
           if ( j < 0 || j >= mat->col) {
                   error("mat_col : Out of range");
           }
           n = mat->row;
           MKVECT(vect,n);
           for(i=0; i<n; i++) {
                   BDY(vect)[i] = BDY(mat)[i][j];
           }
           *rp = vect;
 }  }

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.59

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