The following commit has been merged in the master branch:
commit 2dcc65ebf064ca21de8db6dcb5250d0b64f30aa5
Author: Youhei SASAKI <uwab...@gfd-dennou.org>
Date:   Thu Feb 17 18:29:55 2011 +0900

    Imported Upstream version 0.6.5

diff --git a/ChangeLog b/ChangeLog
index 1adf9ce..cee61b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Thu Feb 17  2011  T Horinouchi
+       * ruby-netcdf-0.6.5 released (relase tag: ruby-netcdf-0_6_5)
+Thu Feb 17  2011  T Horinouchi
+       * extconf.rb: Debug to have the --disable-opendap option really work
+Sat Feb 12  2011  T Horinouchi
+       * ruby-netcdf-0.6.5 preview release.
+Thu Dec 23  2010  T Koshiro
+       * test/aref_aset.rb : updated for Ruby 1.9.2
+       * lib/netcdf.rb: NetCDF.clean_tmpfile : lambda -> proc
+       * verified that all test programs work fine with Ruby 1.9.2.
+
+Tue Dec 14  2010  T Koshiro
+       * netcdfraw.c : nctype2natype : char* -> const char*
+       * test/aref_aset.rb, test/factor_offset.rb : bug fix.
+
+Mon Dec 13  2010  T Koshiro
+       * netcdfraw.c : patch for Ruby 1.9.2
+         - by S Kouketsu (dennou-ruby:003191)
+         - by T Koshiro  (dennou-ruby:003226)
+
 Mon Mar 15  2010  T Horinouchi
        * ruby-netcdf-0.6.4 released (relase tag: ruby-netcdf-0_6_4)
 
diff --git a/extconf.rb b/extconf.rb
index ff42f7e..da90b7c 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -27,8 +27,8 @@ elsif xsystem("opendap-config --libs")
   prefix_dods = `opendap-config --prefix`.gsub(/\n/, "")
 end
 
-if (enable_config('opendap',true) && ( xsystem("opendap-config --libs")) ||
-                                       xsystem("ncdap-config --libs") )
+if (enable_config('opendap',true) && ( xsystem("opendap-config --libs") ||
+                                       xsystem("ncdap-config --libs") ) )
 
   dir_config(libncdods,prefix_dods)
 
diff --git a/lib/netcdf.rb b/lib/netcdf.rb
index 3c26da4..6ff50bf 100644
--- a/lib/netcdf.rb
+++ b/lib/netcdf.rb
@@ -70,7 +70,7 @@ module NumRu
     
     class << NetCDF
        def clean_tmpfile(path)
-         lambda{
+         proc {
             print "removing ", path, "..." if $DEBUG
             if File.exist?(path)
                File.unlink(path) 
diff --git a/netcdfraw.c b/netcdfraw.c
index c8e9797..6ecc045 100644
--- a/netcdfraw.c
+++ b/netcdfraw.c
@@ -6,16 +6,22 @@
 
 /* for compatibility with ruby 1.6 */
 #ifndef RSTRING_PTR
-#define RSTRING_PTR(a) (RSTRING(a)->ptr)
+#define RSTRING_PTR(s) (RSTRING(s)->ptr)
 #endif
 #ifndef RSTRING_LEN
-#define RSTRING_LEN(a) (RSTRING(a)->len)
+#define RSTRING_LEN(s) (RSTRING(s)->len)
 #endif
 #ifndef RARRAY_PTR
-#define RARRAY_PTR(s) (RARRAY(s)->ptr)
+#define RARRAY_PTR(a) (RARRAY(a)->ptr)
 #endif
 #ifndef RARRAY_LEN
-#define RARRAY_LEN(s) (RARRAY(s)->len)
+#define RARRAY_LEN(a) (RARRAY(a)->len)
+#endif
+#ifndef StringValueCStr
+#define StringValueCStr(s) STR2CSTR(s)
+#endif
+#ifndef SafeStringValue
+#define SafeStringValue(s) Check_SafeStr(s)
 #endif
 
 /* Data to NArray */
@@ -345,7 +351,7 @@ NetCDF_free(struct Netcdf *Netcdffile)
 }
 
 static VALUE
-err_status2class(status)
+err_status2class(int status)
 {
   if(NC_ISSYSERR(status)){
     return(rb_eNetcdfSyserr);
@@ -421,7 +427,7 @@ err_status2class(status)
     }
 }
 
-static char*
+static const char*
 nctype2natype(int nctype){
   switch(nctype){
   case NC_CHAR:
@@ -677,7 +683,7 @@ NetCDF_put_att_numeric(int ncid, char *name,VALUE 
value,VALUE atttype, int varid
     ptr = na_val->ptr;
     switch(na_typecode){
     case NA_BYTE: 
-       status = nc_put_att_uchar(ncid,varid,name,NC_BYTE,len,ptr);
+       status = nc_put_att_uchar(ncid,varid,name,NC_BYTE,len,(unsigned char 
*)ptr);
        break;
     case NA_SINT: 
        status = nc_put_att_short(ncid,varid,name,NC_SHORT,len,(short *)ptr);
@@ -794,7 +800,7 @@ NetCDF_def_var(VALUE file,VALUE var_name,VALUE 
vartype,VALUE dimensions)
     switch(TYPE(RARRAY_PTR(dimensions)[c_ndims-1-i])){
     case T_STRING:
       Check_Type(RARRAY_PTR(dimensions)[c_ndims-1-i],T_STRING);
-      c_dim_name=STR2CSTR(RARRAY_PTR(dimensions)[c_ndims-1-i]);
+      c_dim_name=StringValueCStr(RARRAY_PTR(dimensions)[c_ndims-1-i]);
       status=nc_inq_dimid(ncid,c_dim_name,&dimidp);
       if(status != NC_NOERR) NC_RAISE(status);
       c_dimids[i]=dimidp;
@@ -1021,7 +1027,7 @@ NetCDF_open(VALUE mod,VALUE filename,VALUE omode)
   VALUE retval;
 
   Check_Type(filename,T_STRING);
-  Check_SafeStr(filename);
+  SafeStringValue(filename);
   c_filename=RSTRING_PTR(filename);
   Check_Type(omode,T_FIXNUM);
   c_omode=NUM2INT(omode);
@@ -1044,7 +1050,7 @@ NetCDF_create(VALUE mod,VALUE filename,VALUE cmode)
   struct Netcdf *ncfile;
   
   Check_Type(filename,T_STRING);
-  Check_SafeStr(filename);
+  SafeStringValue(filename);
   c_filename=RSTRING_PTR(filename);
   Check_Type(cmode,T_FIXNUM);
   c_cmode=NUM2INT(cmode);
@@ -1194,7 +1200,7 @@ NetCDF_dim_name(VALUE Dim,VALUE dimension_newname)
   ncid=Netcdf_dim->ncid;
   dimid=Netcdf_dim->dimid;
   Check_Type(dimension_newname,T_STRING);
-  c_dim_name = STR2CSTR(dimension_newname);
+  c_dim_name = StringValueCStr(dimension_newname);
 
   status = nc_rename_dim(ncid,dimid,c_dim_name);
   if(status !=NC_NOERR) NC_RAISE(status);
@@ -1268,19 +1274,17 @@ NetCDF_att_rename(VALUE Att,VALUE new_att_name)
   Data_Get_Struct(Att,struct NetCDFAtt,Netcdf_att);
   ncid=Netcdf_att->ncid;
   varid=Netcdf_att->varid;
-  c_att_name=ALLOCA_N(char,NC_MAX_NAME);
-  c_new_att_name=ALLOC_N(char,NC_MAX_NAME);
   
   c_att_name=Netcdf_att->name;
   
   Check_Type(new_att_name,T_STRING);
-  Check_SafeStr(new_att_name);
-  c_new_att_name=STR2CSTR(new_att_name);
+  SafeStringValue(new_att_name);
+  c_new_att_name=StringValueCStr(new_att_name);
   
   status = nc_rename_att(ncid,varid,c_att_name,c_new_att_name);
   if(status != NC_NOERR) NC_RAISE(status);
   
-  Netcdf_att->name=c_new_att_name;
+  strcpy(Netcdf_att->name,c_new_att_name);
   return Qnil;
 }
 
@@ -1472,7 +1476,7 @@ NetCDF_att_atttype(VALUE Att)
   int varid;
   int status;
   char *att_name;
-  char *Attname;
+  const char *Attname;
   struct NetCDFAtt *Netcdf_att;
   nc_type xtypep;
 
@@ -1706,7 +1710,7 @@ NetCDF_var_vartype(VALUE Var)
   int varid;
   nc_type xtypep;
   struct NetCDFVar *Netcdf_var;
-  char *Vartype;
+  const char *Vartype;
   
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   
@@ -1789,7 +1793,7 @@ NetCDF_var_rename(VALUE Var,VALUE var_new_name)
   varid=Netcdf_var->varid;
 
   Check_Type(var_new_name,T_STRING);
-  c_var_new_name=STR2CSTR(var_new_name);
+  c_var_new_name=StringValueCStr(var_new_name);
   
   status = nc_rename_var(ncid,varid,c_var_new_name);
   if(status !=NC_NOERR) NC_RAISE(status);
@@ -1815,7 +1819,7 @@ NetCDF_var_att(VALUE Var,VALUE att_name)
   varid=Netcdf_var->varid;
 
   Check_Type(att_name,T_STRING);
-  c_att_name=STR2CSTR(att_name);
+  c_att_name=StringValueCStr(att_name);
   
   status = nc_inq_attid(ncid,varid,c_att_name,&c_attnump);
   if(status == NC_NOERR){
@@ -1957,7 +1961,7 @@ NetCDF_get_var_char(VALUE Var)
 
   Cbyte_to_NArray(NArray,ndimsp,shape,ptr);
   
-  status = nc_get_var_text(ncid,varid,ptr);
+  status = nc_get_var_text(ncid,varid,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
   OBJ_TAINT(NArray);
@@ -2238,7 +2242,7 @@ NetCDF_get_var1_char(VALUE Var,VALUE start)
   
   
   Cbyte_to_NArray(NArray,ndims,c_count,ptr);
-  status = nc_get_var1_text(ncid,varid,c_start,ptr);
+  status = nc_get_var1_text(ncid,varid,c_start,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
   OBJ_TAINT(NArray);
@@ -2645,7 +2649,7 @@ NetCDF_get_vars_char(VALUE Var,VALUE start,VALUE 
end,VALUE stride)
   
   Cbyte_to_NArray(NArray,ndims,shape,ptr);
   
-  status = nc_get_vars_text(ncid,varid,c_start,c_count,c_stride,ptr);
+  status = nc_get_vars_text(ncid,varid,c_start,c_count,c_stride,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
   OBJ_TAINT(NArray);
@@ -3256,7 +3260,7 @@ NetCDF_put_var_char(VALUE Var,VALUE NArray)
     if(status != NC_NOERR) NC_RAISE(status );
     rb_raise(rb_eNetcdfError,"Length of NArray don't equal to length of total 
array in the '%s'\n",var_name);
   }
-  status = nc_put_var_text(ncid,varid,ptr);
+  status = nc_put_var_text(ncid,varid,(char *)ptr);
   if(status !=NC_NOERR) NC_RAISE(status);
   return Qnil;
 }
@@ -3539,7 +3543,7 @@ NetCDF_put_var1_char(VALUE Var,VALUE NArray,VALUE start)
   }
   Array_to_Cbyte(NArray,ptr);
 
-  status = nc_put_var1_text(ncid,varid,c_start,ptr);
+  status = nc_put_var1_text(ncid,varid,c_start,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
   return Qnil;
 }
@@ -3900,7 +3904,7 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE 
start,VALUE end,VALUE stride)
       } 
   } 
   
-  status = nc_put_vars_text(ncid,varid,c_start,c_count,c_stride,ptr);
+  status = nc_put_vars_text(ncid,varid,c_start,c_count,c_stride,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
   return Qnil;
 }
diff --git a/test/aref_aset.rb b/test/aref_aset.rb
index ef4f059..4ba3456 100644
--- a/test/aref_aset.rb
+++ b/test/aref_aset.rb
@@ -11,7 +11,7 @@ vxy = f.def_var('xy','sfloat',[dx,dy])
 f.enddef
 v.put([1,2,3,4,5])
 p 'testing []= ...'
-v[{0..3,2}]=[100,500]
+v[{0..3=>2}]=[100,500]
 v[1]=999
 v[3..4]=[-99,-99]
 v2.put(666)
@@ -26,10 +26,11 @@ f.close
 f = NetCDF.open(s)
 v = f.var('x')
 p 'testing [] ...'
-p '*0*',v[{0..3,2}]
+p '*0*',v[{0..3=>2}]
 p '*1*',v[1]
 p '*2*',v[3..4],v.rank
 p '*3*',v[[2,0,0]]
+vxy = f.var('xy')
 p '*4*',vxy[[2,0],[0,2,1]]
 p '*5*',vxy[1,[2,0,1]]
 p '*6*',vxy[[4,3],2]
diff --git a/test/factor_offset.rb b/test/factor_offset.rb
index 0ef7f8c..3312327 100644
--- a/test/factor_offset.rb
+++ b/test/factor_offset.rb
@@ -44,10 +44,10 @@ v32 = v3.scaled_get
 p v31
 p v32
 
-print "** scaled_get type fixed to sfloat\n"
-NetCDFVar.scaled_get_type = NArray::SFLOAT
+print "** unpack type fixed to sfloat\n"
+NetCDFVar.unpack_type = NArray::SFLOAT
 v33 = v3.scaled_get
 p v33
-NetCDFVar.scaled_get_type = NArray::INT
+NetCDFVar.unpack_type = NArray::INT
 v33 = v3.scaled_get
 p v33

-- 
Ruby interface of NetCDF library

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-grass-devel

Reply via email to