numo-narray 0.9.0.1 → 0.9.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/ext/numo/narray/array.c +3 -3
  4. data/ext/numo/narray/data.c +102 -81
  5. data/ext/numo/narray/depend.erb +9 -7
  6. data/ext/numo/narray/extconf.rb +4 -24
  7. data/ext/numo/narray/gen/cogen.rb +19 -4
  8. data/ext/numo/narray/gen/def/bit.rb +31 -0
  9. data/ext/numo/narray/gen/def/robject.rb +1 -1
  10. data/ext/numo/narray/gen/dtype.erb.c +11 -257
  11. data/ext/numo/narray/gen/spec.rb +294 -0
  12. data/ext/numo/narray/gen/tmpl/aset.c +1 -1
  13. data/ext/numo/narray/gen/tmpl/each_with_index.c +1 -1
  14. data/ext/numo/narray/gen/tmpl/eye.c +5 -5
  15. data/ext/numo/narray/gen/tmpl/logseq.c +82 -0
  16. data/ext/numo/narray/gen/tmpl/map_with_index.c +1 -1
  17. data/ext/numo/narray/gen/tmpl/rand.c +126 -5
  18. data/ext/numo/narray/gen/tmpl/seq.c +43 -12
  19. data/ext/numo/narray/gen/tmpl/store_bit.c +55 -0
  20. data/ext/numo/narray/gen/tmpl_bit/allocate.c +28 -0
  21. data/ext/numo/narray/gen/tmpl_bit/aref.c +53 -0
  22. data/ext/numo/narray/gen/tmpl_bit/aset.c +63 -0
  23. data/ext/numo/narray/gen/{tmpl/bit_binary.c → tmpl_bit/binary.c} +1 -1
  24. data/ext/numo/narray/gen/{tmpl → tmpl_bit}/bit_count.c +5 -3
  25. data/ext/numo/narray/gen/tmpl_bit/bit_reduce.c +128 -0
  26. data/ext/numo/narray/gen/tmpl_bit/cast.c +37 -0
  27. data/ext/numo/narray/gen/tmpl_bit/cast_array.c +80 -0
  28. data/ext/numo/narray/gen/tmpl_bit/cast_numeric.c +22 -0
  29. data/ext/numo/narray/gen/tmpl_bit/coerce_cast.c +8 -0
  30. data/ext/numo/narray/gen/tmpl_bit/each.c +44 -0
  31. data/ext/numo/narray/gen/tmpl_bit/each_with_index.c +66 -0
  32. data/ext/numo/narray/gen/tmpl_bit/extract.c +25 -0
  33. data/ext/numo/narray/gen/tmpl_bit/fill.c +65 -0
  34. data/ext/numo/narray/gen/tmpl_bit/format.c +61 -0
  35. data/ext/numo/narray/gen/tmpl_bit/format_to_a.c +48 -0
  36. data/ext/numo/narray/gen/tmpl_bit/inspect.c +18 -0
  37. data/ext/numo/narray/gen/tmpl_bit/map_with_index.c +94 -0
  38. data/ext/numo/narray/gen/tmpl_bit/mask.c +117 -0
  39. data/ext/numo/narray/gen/tmpl_bit/none_p.c +14 -0
  40. data/ext/numo/narray/gen/tmpl_bit/store.c +32 -0
  41. data/ext/numo/narray/gen/tmpl_bit/store_array.c +5 -0
  42. data/ext/numo/narray/gen/tmpl_bit/store_bit.c +66 -0
  43. data/ext/numo/narray/gen/tmpl_bit/store_from.c +56 -0
  44. data/ext/numo/narray/gen/tmpl_bit/store_numeric.c +22 -0
  45. data/ext/numo/narray/gen/tmpl_bit/to_a.c +43 -0
  46. data/ext/numo/narray/gen/{tmpl/bit_unary.c → tmpl_bit/unary.c} +1 -1
  47. data/ext/numo/narray/gen/tmpl_bit/where.c +102 -0
  48. data/ext/numo/narray/gen/tmpl_bit/where2.c +37 -0
  49. data/ext/numo/narray/index.c +9 -7
  50. data/ext/numo/narray/math.c +4 -1
  51. data/ext/numo/narray/narray.c +302 -100
  52. data/ext/numo/narray/ndloop.c +21 -36
  53. data/ext/numo/narray/numo/intern.h +3 -3
  54. data/ext/numo/narray/numo/narray.h +5 -41
  55. data/ext/numo/narray/numo/template.h +2 -2
  56. data/ext/numo/narray/numo/types/bit.h +27 -13
  57. data/ext/numo/narray/numo/types/complex.h +2 -2
  58. data/ext/numo/narray/numo/types/complex_macro.h +19 -7
  59. data/ext/numo/narray/numo/types/dcomplex.h +9 -0
  60. data/ext/numo/narray/numo/types/dfloat.h +6 -0
  61. data/ext/numo/narray/numo/types/float_macro.h +9 -2
  62. data/ext/numo/narray/numo/types/int16.h +0 -1
  63. data/ext/numo/narray/numo/types/int32.h +0 -1
  64. data/ext/numo/narray/numo/types/int64.h +0 -1
  65. data/ext/numo/narray/numo/types/int8.h +0 -1
  66. data/ext/numo/narray/numo/types/int_macro.h +2 -1
  67. data/ext/numo/narray/numo/types/robj_macro.h +9 -2
  68. data/ext/numo/narray/numo/types/robject.h +6 -0
  69. data/ext/numo/narray/numo/types/scomplex.h +9 -0
  70. data/ext/numo/narray/numo/types/sfloat.h +6 -0
  71. data/ext/numo/narray/numo/types/uint16.h +0 -1
  72. data/ext/numo/narray/numo/types/uint32.h +0 -1
  73. data/ext/numo/narray/numo/types/uint64.h +0 -1
  74. data/ext/numo/narray/numo/types/uint8.h +0 -1
  75. data/ext/numo/narray/numo/types/uint_macro.h +2 -1
  76. data/ext/numo/narray/numo/types/xint_macro.h +6 -1
  77. data/ext/numo/narray/rand.c +2 -2
  78. data/ext/numo/narray/step.c +7 -7
  79. data/ext/numo/narray/struct.c +9 -9
  80. data/lib/erbpp.rb +6 -2
  81. data/lib/erbpp/narray_def.rb +21 -21
  82. metadata +35 -6
  83. data/ext/numo/narray/gen/bit.erb.c +0 -811
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58347719d04b964755bd500150ee70b9e69b51b0
4
- data.tar.gz: 86ca7cead3efb09e35f4a9cc6377266cecc79df2
3
+ metadata.gz: 74f41e5ff035eb49ec0110722546783161a6fe34
4
+ data.tar.gz: 33bbc3eb268834b15aaa646ca2973efe7061da14
5
5
  SHA512:
6
- metadata.gz: 93df96b4d8153ef292b17f5ae180b034749fddae09cc6f6363437037cc1faffbbdf967529b94e3aa34702748edd4ac1a1455bc3d70b91a90ec8bd2c5fe8bdc88
7
- data.tar.gz: 1771284be1faa0a8a023104be3f7019ef02c16c04198075e11303bbec7988940dadac47a6697f2419c668e230fd4c5e3f751bb0517f61eccbd9b697fa7542bce
6
+ metadata.gz: 360c0c2e95a630ff7fd73adc08df094fe4d3d19072a98fc42cc1e781a1453eaf1c6d5c405db283d0dc744904407fe1e34e3fe97cf133468f751797c69f512133
7
+ data.tar.gz: 9025c1c48a50ddde9fd7bd8d86491165c9cf7cb373efeedf000799a2cf56e24ab21dfe6e4fa0d649fdd35c677c0de725fcf9b4588d8db6dac6a535c0b699e9c7
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Numo::NArray - New NArray class library for Ruby/Numo (NUmerical MOdule)
2
2
 
3
+ [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org/repo/ruby-numo/narray)
3
4
  [![Build Status](https://travis-ci.org/ruby-numo/narray.svg?branch=master)](https://travis-ci.org/ruby-numo/narray)
4
5
 
5
6
  under development
@@ -17,7 +18,7 @@ apt install -y git ruby gcc ruby-dev rake make
17
18
  git clone git://github.com/ruby-numo/narray
18
19
  cd narray
19
20
  gem build numo-narray.gemspec
20
- gem install numo-narray-0.9.0.1.gem
21
+ gem install numo-narray-0.9.0.2.gem
21
22
  ```
22
23
 
23
24
  ## Quick start
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  array.c
3
3
  Numerical Array Extension for Ruby
4
- (C) Copyright 1999-2011 by Masahiro TANAKA
4
+ (C) Copyright 1999-2016 by Masahiro TANAKA
5
5
 
6
6
  This program is free software.
7
7
  You can distribute/modify this program
@@ -268,7 +268,7 @@ na_mdai_result(na_mdai_t *mdai, na_compose_t *nc)
268
268
  for (i=0; i<ndim; i++) {
269
269
  shape[i] = mdai->item[i].shape;
270
270
  //printf("shape[%d]=%d\n",i,shape[i]);
271
- //rb_ary_push( shape, SIZE2NUM(mdai->item[i].shape) );
271
+ //rb_ary_push( shape, SIZET2NUM(mdai->item[i].shape) );
272
272
  }
273
273
 
274
274
  // DataType
@@ -355,7 +355,7 @@ na_s_array_shape(VALUE mod, VALUE ary)
355
355
  Data_Get_Struct(vnc, na_compose_t, nc);
356
356
  shape = rb_ary_new2(nc->ndim);
357
357
  for (i=0; i<nc->ndim; i++) {
358
- rb_ary_push( shape, SIZE2NUM(nc->shape[i]) );
358
+ rb_ary_push( shape, SIZET2NUM(nc->shape[i]) );
359
359
  }
360
360
  return shape;
361
361
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  data.c
3
3
  Numerical Array Extension for Ruby
4
- (C) Copyright 1999-2011,2013 by Masahiro TANAKA
4
+ (C) Copyright 1999-2016 by Masahiro TANAKA
5
5
 
6
6
  This program is free software.
7
7
  You can distribute/modify this program
@@ -76,7 +76,6 @@ na_copy(VALUE self)
76
76
  return v;
77
77
  }
78
78
 
79
-
80
79
  VALUE
81
80
  na_store(VALUE self, VALUE src)
82
81
  {
@@ -198,65 +197,72 @@ na_transpose_map(VALUE self, int *map)
198
197
  VALUE
199
198
  na_transpose(int argc, VALUE *argv, VALUE self)
200
199
  {
201
- int ndim, *map, tmp;
202
- int row_major;
203
- int i, j, c, r;
204
- size_t len;
205
- ssize_t beg, step;
206
- volatile VALUE v, view;
200
+ int ndim, *map, *permute;
201
+ int i, d;
202
+ bool is_positive, is_negative;
207
203
  narray_t *na1;
208
204
 
209
205
  GetNArray(self,na1);
210
206
  ndim = na1->ndim;
211
- row_major = TEST_COLUMN_MAJOR( self );
212
-
207
+ if (ndim < 2) {
208
+ if (argc > 0) {
209
+ rb_raise(rb_eArgError, "unnecessary argument for 1-d array");
210
+ }
211
+ return na_make_view(self);
212
+ }
213
213
  map = ALLOCA_N(int,ndim);
214
- for (i=0;i<ndim;i++) {
215
- map[i] = i;
216
- }
217
- if (argc==0) {
218
- SWAP(map[ndim-1], map[ndim-2], tmp);
219
- goto new_object;
220
- }
221
- if (argc==2) {
222
- if (TYPE(argv[0])==T_FIXNUM && TYPE(argv[1])==T_FIXNUM) {
223
- i = FIX2INT(argv[0]);
224
- j = FIX2INT(argv[1]);
225
- if (row_major) {
226
- i = ndim-1-i;
227
- j = ndim-1-j;
228
- }
229
- SWAP( map[i], map[j], tmp );
230
- goto new_object;
231
- }
214
+ if (argc == 0) {
215
+ for (i=0; i < ndim; i++) {
216
+ map[i] = ndim-1-i;
217
+ }
218
+ return na_transpose_map(self,map);
232
219
  }
233
- for (i=argc,c=ndim-1; i;) {
234
- v = argv[--i];
235
- if (TYPE(v)==T_FIXNUM) {
236
- beg = FIX2INT(v);
237
- len = 1;
238
- step = 0;
239
- } else if (rb_obj_is_kind_of(v,rb_cRange) || rb_obj_is_kind_of(v,na_cStep)) {
240
- // write me
241
- nary_step_array_index(v, ndim, &len, &beg, &step);
242
- //printf("len=%d beg=%d step=%d\n",len,beg,step);
243
- }
244
- for (j=len; j; ) {
245
- r = beg + step*(--j);
246
- if (row_major) {
247
- r = ndim-1-r;
220
+ // with argument
221
+ if (argc > ndim) {
222
+ rb_raise(rb_eArgError, "more arguments than ndim");
223
+ }
224
+ for (i=0; i < ndim; i++) {
225
+ map[i] = i;
226
+ }
227
+ permute = ALLOCA_N(int,argc);
228
+ for (i=0; i < argc; i++) {
229
+ permute[i] = 0;
230
+ }
231
+ is_positive = is_negative = 0;
232
+ for (i=0; i < argc; i++) {
233
+ if (TYPE(argv[i]) != T_FIXNUM) {
234
+ rb_raise(rb_eArgError, "invalid argument");
235
+ }
236
+ d = FIX2INT(argv[i]);
237
+ if (d >= 0) {
238
+ if (d >= argc) {
239
+ rb_raise(rb_eArgError, "out of dimension range");
248
240
  }
249
- if ( c < 0 ) {
250
- rb_raise(rb_eArgError, "too many dims");
241
+ if (is_negative) {
242
+ rb_raise(rb_eArgError, "dimension must be non-negative only or negative only");
251
243
  }
252
- map[c--] = r;
253
- //printf("r=%d\n",r);
254
- }
244
+ if (permute[d]) {
245
+ rb_raise(rb_eArgError, "not permutation");
246
+ }
247
+ map[i] = d;
248
+ permute[d] = 1;
249
+ is_positive = 1;
250
+ } else {
251
+ if (d < -argc) {
252
+ rb_raise(rb_eArgError, "out of dimension range");
253
+ }
254
+ if (is_positive) {
255
+ rb_raise(rb_eArgError, "dimension must be non-negative only or negative only");
256
+ }
257
+ if (permute[argc+d]) {
258
+ rb_raise(rb_eArgError, "not permutation");
259
+ }
260
+ map[ndim-argc+i] = ndim+d;
261
+ permute[argc+d] = 1;
262
+ is_negative = 1;
263
+ }
255
264
  }
256
-
257
- new_object:
258
- view = na_transpose_map(self,map);
259
- return view;
265
+ return na_transpose_map(self,map);
260
266
  }
261
267
 
262
268
  //----------------------------------------------------------------------
@@ -304,7 +310,7 @@ na_reshape(int argc, VALUE *argv, VALUE self)
304
310
  rb_raise(rb_eArgError, "Total size must be same");
305
311
  }
306
312
 
307
- copy = na_copy(self);
313
+ copy = rb_funcall(self,rb_intern("copy"),0);
308
314
  GetNArray(copy,na);
309
315
  //shape_save = NA_SHAPE(na);
310
316
  na_setup_shape(na,argc,shape);
@@ -592,7 +598,7 @@ na_diagonal(int argc, VALUE *argv, VALUE self)
592
598
  }
593
599
 
594
600
  if (vofs) {
595
- kofs = NUM2SSIZE(vofs);
601
+ kofs = NUM2SSIZET(vofs);
596
602
  } else {
597
603
  kofs = 0;
598
604
  }
@@ -627,15 +633,15 @@ na_diagonal(int argc, VALUE *argv, VALUE self)
627
633
  k0 = 0;
628
634
  k1 = kofs;
629
635
  if (k1 >= na->shape[ax[1]]) {
630
- rb_raise(rb_eArgError,"invalid diagonal offset(%ld) for "
631
- "last dimension size(%ld)",kofs,na->shape[ax[1]]);
636
+ rb_raise(rb_eArgError,"invalid diagonal offset(%"SZF"d) for "
637
+ "last dimension size(%"SZF"d)",kofs,na->shape[ax[1]]);
632
638
  }
633
639
  } else {
634
640
  k0 = -kofs;
635
641
  k1 = 0;
636
642
  if (k0 >= na->shape[ax[0]]) {
637
- rb_raise(rb_eArgError,"invalid diagonal offset(=%ld) for "
638
- "last-1 dimension size(%ld)",kofs,na->shape[ax[0]]);
643
+ rb_raise(rb_eArgError,"invalid diagonal offset(=%"SZF"d) for "
644
+ "last-1 dimension size(%"SZF"d)",kofs,na->shape[ax[0]]);
639
645
  }
640
646
  }
641
647
 
@@ -749,7 +755,7 @@ na_diagonal(int argc, VALUE *argv, VALUE self)
749
755
  static VALUE
750
756
  na_new_dimension_for_dot(VALUE self, int pos, int len, bool transpose)
751
757
  {
752
- int i, k, nd;
758
+ int i, k, l, nd;
753
759
  size_t j;
754
760
  size_t *idx1, *idx2;
755
761
  size_t *shape;
@@ -775,27 +781,25 @@ na_new_dimension_for_dot(VALUE self, int pos, int len, bool transpose)
775
781
  }
776
782
  nd += len;
777
783
  shape = ALLOCA_N(size_t,nd);
778
- i = k = 0;
779
- while (i < nd) {
780
- if (i == pos) {
781
- for (; len; len--) {
782
- shape[i++] = 1;
783
- }
784
- pos = -1; // new axis done
785
- } else {
786
- shape[i++] = na->shape[k++];
787
- }
788
- }
789
-
790
- na_setup_shape((narray_t*)na2, nd, shape);
791
784
  na2->stridx = ALLOC_N(stridx_t,nd);
792
785
 
793
786
  switch(na->type) {
794
787
  case NARRAY_DATA_T:
795
788
  case NARRAY_FILEMAP_T:
789
+ i = k = 0;
790
+ while (i < nd) {
791
+ if (i == pos && len > 0) {
792
+ for (l=0; l<len; l++) {
793
+ shape[i++] = 1;
794
+ }
795
+ } else {
796
+ shape[i++] = na->shape[k++];
797
+ }
798
+ }
799
+ na_setup_shape((narray_t*)na2, nd, shape);
796
800
  stride = na_get_elmsz(self);
797
801
  for (i=nd; i--;) {
798
- SDX_SET_STRIDE(na2->stridx[i],stride);
802
+ SDX_SET_STRIDE(na2->stridx[i], stride);
799
803
  stride *= shape[i];
800
804
  }
801
805
  na2->offset = 0;
@@ -803,18 +807,35 @@ na_new_dimension_for_dot(VALUE self, int pos, int len, bool transpose)
803
807
  break;
804
808
  case NARRAY_VIEW_T:
805
809
  GetNArrayView(self, na1);
806
- for (i=0; i<nd; i++) {
807
- if (SDX_IS_INDEX(na1->stridx[i])) {
808
- idx1 = SDX_GET_INDEX(na1->stridx[i]);
809
- idx2 = ALLOC_N(size_t,na1->base.shape[i]);
810
- for (j=0; j<na1->base.shape[i]; j++) {
811
- idx2[j] = idx1[j];
810
+ i = k = 0;
811
+ while (i < nd) {
812
+ if (i == pos && len > 0) {
813
+ if (SDX_IS_INDEX(na1->stridx[k])) {
814
+ stride = SDX_GET_INDEX(na1->stridx[k])[0];
815
+ } else {
816
+ stride = SDX_GET_STRIDE(na1->stridx[k]);
817
+ }
818
+ for (l=0; l<len; l++) {
819
+ shape[i] = 1;
820
+ SDX_SET_STRIDE(na2->stridx[i], stride);
821
+ i++;
812
822
  }
813
- SDX_SET_INDEX(na2->stridx[i],idx2);
814
823
  } else {
815
- na2->stridx[i] = na1->stridx[i];
824
+ shape[i] = na1->base.shape[k];
825
+ if (SDX_IS_INDEX(na1->stridx[k])) {
826
+ idx1 = SDX_GET_INDEX(na1->stridx[k]);
827
+ idx2 = ALLOC_N(size_t,na1->base.shape[k]);
828
+ for (j=0; j<na1->base.shape[k]; j++) {
829
+ idx2[j] = idx1[j];
830
+ }
831
+ SDX_SET_INDEX(na2->stridx[i], idx2);
832
+ } else {
833
+ na2->stridx[i] = na1->stridx[k];
834
+ }
835
+ i++; k++;
816
836
  }
817
837
  }
838
+ na_setup_shape((narray_t*)na2, nd, shape);
818
839
  na2->offset = na1->offset;
819
840
  na2->data = na1->data;
820
841
  break;
@@ -17,17 +17,19 @@ C_TMPL = <%=Dir.glob("#{__dir__}/gen/tmpl/*.c").join(" ")%>
17
17
 
18
18
  COGEN = <%= __dir__ %>/gen/cogen.rb
19
19
  DTYPE = <%= __dir__ %>/gen/dtype.erb.c
20
- COGEN_DTYPE = $(COGEN) -l $(DTYPE)
21
20
  DEPENDS = $(C_TMPL) $(DTYPE) <%= __dir__ %>/gen/*.rb
22
21
 
23
- <% Dir.glob("#{__dir__}/gen/def/*.rb") do |s| %>
24
- types/<%=File.basename(s,".rb")%>.c: <%=s%> $(DEPENDS)
22
+ <%
23
+ type_c = ["types/bit.c"]
24
+ type_rb = Dir.glob("#{__dir__}/gen/def/*.rb")
25
+ type_rb.each do |s|
26
+ type_c << c = "types/"+File.basename(s,".rb")+".c"
27
+ %>
28
+ <%=c%>: <%=s%> $(DEPENDS)
25
29
  $(MAKEDIRS) $(@D) types
26
- ruby $(COGEN_DTYPE) <%=s%> > $@
30
+ ruby $(COGEN) -l -o $@ $(DTYPE) <%=s%>
27
31
  <% end %>
28
32
 
29
- types/bit.c: <%= __dir__ %>/gen/bit.erb.c $(DEPENDS)
30
- $(MAKEDIRS) $(@D) types
31
- ruby $(COGEN) -l <%= __dir__ %>/gen/bit.erb.c > $@
33
+ src : <%= type_c.join(" ") %>
32
34
 
33
35
  CLEANOBJS = *.o */*.o *.bak types/*.c
@@ -1,9 +1,5 @@
1
1
  require 'rbconfig.rb'
2
-
3
- #RbConfig::MAKEFILE_CONFIG["optflags"] = "-g3 -gdwarf-2"
4
-
5
2
  require 'mkmf'
6
-
7
3
  require "erb"
8
4
 
9
5
  if RUBY_VERSION < "2.0.0"
@@ -11,12 +7,15 @@ if RUBY_VERSION < "2.0.0"
11
7
  exit(1)
12
8
  end
13
9
 
10
+ rm_f 'numo/extconf.h'
11
+
14
12
  #$CFLAGS="-g3 -O0 -Wall"
15
13
  #$CFLAGS=" $(cflags) -O3 -m64 -msse2 -funroll-loops"
16
14
  #$CFLAGS=" $(cflags) -O3"
17
15
  $INCFLAGS = "-Itypes #$INCFLAGS"
18
16
 
19
17
  $INSTALLFILES = Dir.glob(%w[numo/*.h numo/types/*.h]).map{|x| [x,'$(archdir)'] }
18
+ $INSTALLFILES << ['numo/extconf.h','$(archdir)']
20
19
  if /cygwin|mingw/ =~ RUBY_PLATFORM
21
20
  $INSTALLFILES << ['libnarray.a', '$(archdir)']
22
21
  end
@@ -48,20 +47,6 @@ struct
48
47
  rand
49
48
  )
50
49
 
51
- =begin
52
- have_header("atlas/cblas.h")
53
- have_library("atlas")
54
-
55
- if have_library("blas")
56
- if have_library("lapack")
57
- srcs.push "linalg"
58
- $defs.push "-DHAVE_LAPACK"
59
- else
60
- #$defs.delete "-DHAVE_LAPACK"
61
- end
62
- end
63
- =end
64
-
65
50
  if have_header("stdbool.h")
66
51
  stdbool = "stdbool.h"
67
52
  else
@@ -91,19 +76,14 @@ have_type("int64_t", stdint)
91
76
  unless have_type("u_int64_t", stdint)
92
77
  have_type("uint64_t", stdint)
93
78
  end
94
- #have_library("m")
95
- #have_func("sincos")
96
- #have_func("asinh")
97
79
  have_func("exp10")
98
80
 
99
81
  have_var("rb_cComplex")
100
82
  have_var("rb_cFixnum")
101
- #have_func("rb_alloc_tmp_buffer", "ruby.h")
102
- #have_func("rb_free_tmp_buffer", "ruby.h")
103
83
 
104
84
  $objs = srcs.collect{|i| i+".o"}
105
85
 
106
- create_header
86
+ create_header('numo/extconf.h')
107
87
 
108
88
  depend_path = File.join(__dir__, "depend")
109
89
  File.open(depend_path, "w") do |depend|
@@ -4,9 +4,18 @@ libpath = File.absolute_path(File.dirname(__FILE__))+"/../../../../lib"
4
4
  $LOAD_PATH.unshift libpath
5
5
 
6
6
  require "erbpp/narray_def"
7
- if ARGV[0] == "-l"
8
- require "erbpp/line_number"
9
- ARGV.shift
7
+ while true
8
+ if ARGV[0] == "-l"
9
+ require "erbpp/line_number"
10
+ ARGV.shift
11
+ elsif ARGV[0] == "-o"
12
+ ARGV.shift
13
+ $output = ARGV.shift
14
+ require "fileutils"
15
+ FileUtils.rm_f($output)
16
+ else
17
+ break
18
+ end
10
19
  end
11
20
 
12
21
  unless (1..2) === ARGV.size
@@ -15,4 +24,10 @@ unless (1..2) === ARGV.size
15
24
  end
16
25
 
17
26
  erb_path, type_file = ARGV
18
- DataType.new(erb_path, type_file).run
27
+
28
+ if $output
29
+ s = DataType.new(erb_path, type_file).result
30
+ open($output,"w").write(s)
31
+ else
32
+ DataType.new(erb_path, type_file).run
33
+ end