ruby-dcl 1.6.3.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Ruby::Dcl::1.7.0
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ruby-dcl-1.7.0'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ruby-dcl-1.7.0
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,44 +1,24 @@
1
- require 'rake/gempackagetask'
1
+ require 'rbconfig' unless defined? RbConfig
2
+ begin
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
2
5
 
3
- NAME = 'ruby-dcl'
4
- VER = '1.6.3.1'
6
+ Rake::TestTask.new
7
+ task :default => :test
8
+ rescue LoadError
9
+ end
5
10
 
6
- PKG_FILES = FileList[
7
- '**',
8
- 'lib/**',
9
- 'GenWrapper/**/**',
10
- 'obsolete/**',
11
- 'demo/**/**'
12
- ]
13
- #gem_load_dir = Gem.default_dir
14
11
 
15
- spec = Gem::Specification.new do |s|
16
- s.name = NAME
17
- s.version = VER
18
- s.authors = ["T. Horinouchi", "K. Kuroi", "K. Goto"\
19
- ,"S. Nishizawa", "T. Koshiro",'GFD Dennou Club']
20
- s.email = 'eriko@gfd-dennou.org'
21
- s.homepage = \
22
- 'http://www.gfd-dennou.org/arch/ruby/products/ruby-dcl/'
23
- s.licenses = ["GFD Dennou Club"]
24
- s.platform = Gem::Platform::RUBY
25
- s.summary = 'one-to-one interface to the DCL graphic library'
26
- s.description = 'RubyDCL is a ruby interface to the scientific graphic library DCL. It supports all the subroutines and functions in DCL on a one-to-one basis. '
27
- s.files = PKG_FILES.to_a
28
- s.require_paths = ['lib']
29
- #s.test_files = Dir.glob("test/*")
30
- s.has_rdoc = true
31
- s.required_ruby_version = Gem::Requirement.new(">= 1.6")
32
- s.add_runtime_dependency(%q<narray>, [">= 0.5.5"])
33
- s.add_runtime_dependency(%q<narray_miss>, [">= 0"])
34
- s.add_runtime_dependency(%q<gtk2>, [">= 0"])
35
- #s.extra_rdoc_files = ['README']
12
+ destdir = ENV["DESTDIR"] || ""
13
+ sitelibdir = ENV["SITELIBDIR"] || RbConfig::CONFIG["sitelibdir"]
36
14
 
37
- #-- extensions
38
- s.extensions << "extconf.rb"
39
- end
15
+ LIBS = FileList["lib/**/*rb"]
40
16
 
41
- Rake::GemPackageTask.new(spec) do |pkg|
42
- pkg.gem_spec = spec
43
- pkg.need_tar = true
17
+ task :nongeminstall do
18
+ prefix = File.join(destdir, sitelibdir)
19
+ LIBS.each do |lib|
20
+ dst = File.join(prefix, File.dirname(lib.sub(/\Alib\//,"")))
21
+ mkdir_p dst
22
+ install lib, dst, :mode => 0644
23
+ end
44
24
  end
data/dcl_narrayed_funcs.c CHANGED
@@ -11,8 +11,9 @@
11
11
  #include "libtinyf2c.h"
12
12
  #include "narray.h"
13
13
 
14
+ /* for compatibility with ruby 1.6 */
14
15
  #ifndef RARRAY_LEN
15
- # define RARRAY_LEN(ary) (RARRAY(ary)->len)
16
+ #define RARRAY_LEN(a) (RARRAY(a)->len)
16
17
  #endif
17
18
 
18
19
  #define DFLT_SIZE 32
@@ -35,31 +36,31 @@ extern void dcl_freecrealary(real *);
35
36
  extern void dcl_freeccomplexary(complex *);
36
37
  extern void dcl_freeclogicalary(logical *);
37
38
 
38
- /* for functions which return doublereal */
39
+ /* for functions which return real */
39
40
  /* fnclib */
40
- extern doublereal rd2r_(real *);
41
- extern doublereal rr2d_(real *);
42
- extern doublereal rexp_(real *, integer *, integer *);
43
- extern doublereal rfpi_(void);
44
- extern doublereal rmod_(real *, real *);
41
+ extern real rd2r_(real *);
42
+ extern real rr2d_(real *);
43
+ extern real rexp_(real *, integer *, integer *);
44
+ extern real rfpi_(void);
45
+ extern real rmod_(real *, real *);
45
46
  /* gnmlib */
46
- extern doublereal rgnlt_(real *);
47
- extern doublereal rgnle_(real *);
48
- extern doublereal rgngt_(real *);
49
- extern doublereal rgnge_(real *);
47
+ extern real rgnlt_(real *);
48
+ extern real rgnle_(real *);
49
+ extern real rgngt_(real *);
50
+ extern real rgnge_(real *);
50
51
  /* rfalib */
51
- extern doublereal rmax_(real *, integer *, integer *);
52
- extern doublereal rmin_(real *, integer *, integer *);
53
- extern doublereal rsum_(real *, integer *, integer *);
54
- extern doublereal rave_(real *, integer *, integer *);
55
- extern doublereal rvar_(real *, integer *, integer *);
56
- extern doublereal rstd_(real *, integer *, integer *);
57
- extern doublereal rrms_(real *, integer *, integer *);
58
- extern doublereal ramp_(real *, integer *, integer *);
52
+ extern real rmax_(real *, integer *, integer *);
53
+ extern real rmin_(real *, integer *, integer *);
54
+ extern real rsum_(real *, integer *, integer *);
55
+ extern real rave_(real *, integer *, integer *);
56
+ extern real rvar_(real *, integer *, integer *);
57
+ extern real rstd_(real *, integer *, integer *);
58
+ extern real rrms_(real *, integer *, integer *);
59
+ extern real ramp_(real *, integer *, integer *);
59
60
  /* rfblib */
60
- extern doublereal rprd_(real *, real *, integer *, integer *, integer *);
61
- extern doublereal rcov_(real *, real *, integer *, integer *, integer *);
62
- extern doublereal rcor_(real *, real *, integer *, integer *, integer *);
61
+ extern real rprd_(real *, real *, integer *, integer *, integer *);
62
+ extern real rcov_(real *, real *, integer *, integer *, integer *);
63
+ extern real rcor_(real *, real *, integer *, integer *, integer *);
63
64
 
64
65
 
65
66
  extern int stftrf_(real*,real*,real*,real*);
@@ -27,31 +27,31 @@ extern void dcl_freecrealary(real *);
27
27
  extern void dcl_freeccomplexary(complex *);
28
28
  extern void dcl_freeclogicalary(logical *);
29
29
 
30
- /* for functions which return doublereal */
30
+ /* for functions which return real */
31
31
  /* fnclib */
32
- extern doublereal rd2r_(real *);
33
- extern doublereal rr2d_(real *);
34
- extern doublereal rexp_(real *, integer *, integer *);
35
- extern doublereal rfpi_(void);
36
- extern doublereal rmod_(real *, real *);
32
+ extern real rd2r_(real *);
33
+ extern real rr2d_(real *);
34
+ extern real rexp_(real *, integer *, integer *);
35
+ extern real rfpi_(void);
36
+ extern real rmod_(real *, real *);
37
37
  /* gnmlib */
38
- extern doublereal rgnlt_(real *);
39
- extern doublereal rgnle_(real *);
40
- extern doublereal rgngt_(real *);
41
- extern doublereal rgnge_(real *);
38
+ extern real rgnlt_(real *);
39
+ extern real rgnle_(real *);
40
+ extern real rgngt_(real *);
41
+ extern real rgnge_(real *);
42
42
  /* rfalib */
43
- extern doublereal rmax_(real *, integer *, integer *);
44
- extern doublereal rmin_(real *, integer *, integer *);
45
- extern doublereal rsum_(real *, integer *, integer *);
46
- extern doublereal rave_(real *, integer *, integer *);
47
- extern doublereal rvar_(real *, integer *, integer *);
48
- extern doublereal rstd_(real *, integer *, integer *);
49
- extern doublereal rrms_(real *, integer *, integer *);
50
- extern doublereal ramp_(real *, integer *, integer *);
43
+ extern real rmax_(real *, integer *, integer *);
44
+ extern real rmin_(real *, integer *, integer *);
45
+ extern real rsum_(real *, integer *, integer *);
46
+ extern real rave_(real *, integer *, integer *);
47
+ extern real rvar_(real *, integer *, integer *);
48
+ extern real rstd_(real *, integer *, integer *);
49
+ extern real rrms_(real *, integer *, integer *);
50
+ extern real ramp_(real *, integer *, integer *);
51
51
  /* rfblib */
52
- extern doublereal rprd_(real *, real *, integer *, integer *, integer *);
53
- extern doublereal rcov_(real *, real *, integer *, integer *, integer *);
54
- extern doublereal rcor_(real *, real *, integer *, integer *, integer *);
52
+ extern real rprd_(real *, real *, integer *, integer *, integer *);
53
+ extern real rcov_(real *, real *, integer *, integer *, integer *);
54
+ extern real rcor_(real *, real *, integer *, integer *, integer *);
55
55
 
56
56
 
57
57
  extern VALUE mDCL;
@@ -0,0 +1,38 @@
1
+ #
2
+ # uipk01.rb
3
+ #
4
+ # $Id: uipk01.rb,v 1.1 2012-03-30 13:57:40 koshiro Exp $
5
+ #
6
+
7
+ require "narray"
8
+ require "numru/dcl"
9
+
10
+ include NumRu
11
+
12
+ DCL::swiset('WINDOW_HEIGHT', 300)
13
+ DCL::swiset('WINDOW_WIDTH', 300)
14
+
15
+ iws = (ARGV[0] || (puts ' WORKSTATION ID (I) ? ;'; DCL::sgpwsn; gets)).to_i
16
+
17
+ DCL::gropn(iws)
18
+ DCL::grfrm
19
+ DCL::grswnd(0.0, 256.0, 0.0, 256.0)
20
+ DCL::grsvpt(0.1, 0.9, 0.1, 0.9)
21
+ DCL::grstrn(1)
22
+ DCL::grstrf
23
+
24
+ (1..255).each do |i|
25
+ a = [i.to_f, i.to_f]
26
+ (1..255).each do |j|
27
+ b = [(j-1).to_f, j.to_f]
28
+
29
+ DCL::sgplxu(a, b, 1, 1, DCL::isgrgb(i,j,0))
30
+ end
31
+ end
32
+
33
+ DCL::uxaxdv('t', 16, 64)
34
+ DCL::uxaxdv('b', 16, 64)
35
+ DCL::uyaxdv('l', 16, 64)
36
+ DCL::uyaxdv('r', 16, 64)
37
+
38
+ DCL::grcls
@@ -0,0 +1,48 @@
1
+ #
2
+ # uipk02.rb
3
+ #
4
+ # $Id: uipk02.rb,v 1.1 2012-03-09 02:02:12 koshiro Exp $
5
+ #
6
+
7
+ require "narray"
8
+ require "numru/dcl"
9
+
10
+ include NumRu
11
+ include Math
12
+
13
+
14
+ nx = 50
15
+ ny = 50
16
+
17
+ z = NArray.sfloat(nx, ny)
18
+ p z.rank
19
+ p z.class
20
+
21
+ #-- data ---
22
+ for j in 0..ny-1
23
+ for i in 0..nx-1
24
+ z[i,j] = - (i-(nx-1)/2.0)**2 - (j-(ny-1)/2.0)**2
25
+ end
26
+ end
27
+
28
+ #-- graph ---
29
+ DCL::swiset('WINDOW_HEIGHT', 300)
30
+ DCL::swiset('WINDOW_WIDTH', 300)
31
+
32
+ iws = (ARGV[0] || (puts ' WORKSTATION ID (I) ? ;'; DCL::sgpwsn; gets)).to_i
33
+
34
+ DCL::gropn iws
35
+ DCL::grfrm
36
+ DCL::grswnd(-1.0, 1.0, -1.0, 1.0)
37
+ DCL::grsvpt(0.1, 0.9, 0.1, 0.9)
38
+ DCL::grstrn(1)
39
+ DCL::grstrf
40
+
41
+ DCL::uipdat(z)
42
+
43
+ DCL::uxaxdv('t', 0.1, 0.5)
44
+ DCL::uxaxdv('b', 0.1, 0.5)
45
+ DCL::uyaxdv('l', 0.1, 0.5)
46
+ DCL::uyaxdv('r', 0.1, 0.5)
47
+
48
+ DCL::grcls
@@ -0,0 +1,89 @@
1
+ #
2
+ # test09.rb
3
+ #
4
+ # T Horinouchi 2004/11/11
5
+
6
+ require "numru/dcl"
7
+ include NumRu
8
+
9
+ raise "This program is for DCL 5.3 or later" unless DCL::DCLVERSION >= '5.3'
10
+
11
+ nx=73
12
+ ny=37
13
+ xmin=0.0
14
+ xmax=360.0
15
+ ymin=-90.0
16
+ ymax=90.0
17
+
18
+ ctr = [ 'CYL','MER','MWD','HMR','EK6','KTD','CON','COA','COC','BON',
19
+ 'OTG','PST','AZM','AZA']
20
+ fct = [ 0.12, 0.12, 0.14, 0.14, 0.14, 0.14,0.11, 0.16, 0.12, 0.12,
21
+ 0.40, 0.12, 0.12, 0.17 ]
22
+ np = ctr.length # == fct.length
23
+
24
+ p = NArray.sfloat(nx*ny)
25
+ i = 0
26
+ File.foreach('t811231.dat') do |line|
27
+ line.split(" ").each do |data|
28
+ p[i] = data.to_f
29
+ i += 1
30
+ end
31
+ end
32
+ p.reshape!(nx, ny)
33
+
34
+ 190.step(245, 5) do |r|
35
+ amin=r
36
+ amax=r+5
37
+ # IDX=(R-180)*1.4*1000+999
38
+ idx=((r-170)*1.25).to_i*1000+999
39
+ DCL::uestlv(amin, amax, idx)
40
+ end
41
+
42
+ #-- graph ---
43
+
44
+ iws = (ARGV.shift || (puts ' WORKSTATION ID (I) ? ;'; DCL::sgpwsn; gets)).to_i
45
+ DCL::sglset('LSOFTF', false)
46
+ DCL::swlset('LCMCH', true)
47
+ DCL::sgrset('STLAT1', 75.0)
48
+ DCL::sgrset('STLAT2', 60.0)
49
+ DCL::umlset('LGRIDMJ', false)
50
+ DCL::umrset('DGRIDMN', 30.0)
51
+
52
+ nn = DCL::sgqcmn
53
+
54
+ DCL::sgscmn(1)
55
+ DCL::sgopn(iws)
56
+
57
+ for i in 0..np-1
58
+ icn= (i % nn) + 1
59
+ print "colormap ",icn,": ",DCL::swqcmd(icn),"\n"
60
+ DCL::sgscmn(i+1)
61
+ DCL::sgfrm
62
+ DCL::sgssim(fct[i], 0.0, 0.0)
63
+ DCL::sgsmpl(165.0, 60.0, 0.0)
64
+ DCL::sgsvpt(0.1, 0.9, 0.1, 0.9)
65
+ DCL::sgswnd(xmin, xmax, ymin, ymax)
66
+ if (ctr[i] == 'OTG')
67
+ DCL::sgstxy(-180.0, 180.0, 0.0, 90.0)
68
+ else
69
+ DCL::sgstxy(-180.0, 180.0, -90.0, 90.0)
70
+ end
71
+ DCL::sgstrn(DCL::isgtrc(ctr[i]))
72
+ DCL::sgstrf
73
+
74
+ DCL::sglset('LCLIP', true)
75
+ DCL::slpwwr(1)
76
+ DCL::slpvpr(1)
77
+ cttl = DCL::sgtrnl(DCL::isgtrc(ctr[i]))
78
+ DCL::sgtxzr(0.5, 0.95, cttl, 0.03, 0, 0, 3)
79
+
80
+ DCL::uetone(p)
81
+ DCL::udcntr(p)
82
+ DCL::umfmap('coast_world')
83
+ DCL::umpmap('coast_world')
84
+ DCL::umpglb
85
+ DCL::slpvpr(1)
86
+ end
87
+ DCL::swpcls
88
+
89
+ DCL::sgcls
@@ -0,0 +1,55 @@
1
+ #
2
+ # cslb01.rb
3
+ #
4
+ # $Id: cslb01.rb,v 1.2 2012-03-30 13:57:40 koshiro Exp $
5
+ #
6
+
7
+ require "narray"
8
+ require "numru/dcl"
9
+ include NumRu
10
+ include Math
11
+
12
+ nx=100
13
+ ny=100
14
+ level=256
15
+
16
+ r = NArray.float(nx,ny)
17
+ g = NArray.float(nx,ny)
18
+ b = NArray.float(nx,ny)
19
+
20
+ nx.times do |i|
21
+ ny.times do |j|
22
+ r[i,j] = exp(-((i-nx/2.0)**2.0 + (j-ny/2.0)**2.0) / 5000.0)
23
+ g[i,j] = exp(-((i-nx/1.1)**2.0 + (j-ny/1.2)**2.0) / 1000.0)
24
+ b[i,j] = exp(-((i-ny/3.0)**2.0 + (j-ny/5.0)**2.0) / 3000.0)
25
+ end
26
+ end
27
+
28
+ rc = DCL::rnorml(r,0.0,1.0)
29
+ gc = DCL::rnorml(g,0.2,1.0)
30
+ bc = DCL::rnorml(b,0.0,1.0)
31
+
32
+ DCL::swiset('WINDOW_HEIGHT', 300)
33
+ DCL::swiset('WINDOW_WIDTH', 300)
34
+
35
+ iws = (ARGV[0] || (puts ' WORKSTATION ID (I) ? ;'; DCL::sgpwsn; gets)).to_i
36
+
37
+ DCL::gropn(iws)
38
+ DCL::grfrm
39
+ DCL::grswnd(-1.0, 1.0, -1.0, 1.0)
40
+ DCL::grsvpt(0.1, 0.9, 0.1, 0.9)
41
+ DCL::grstrn(1)
42
+ DCL::grstrf
43
+
44
+ DCL::prcopn('DclPaintGrid3')
45
+
46
+ DCL::uipda3(rc, gc, bc)
47
+
48
+ DCL::prccls('DclPaintGrid3')
49
+
50
+ DCL::uxaxdv('t', 0.1, 0.5)
51
+ DCL::uxaxdv('b', 0.1, 0.5)
52
+ DCL::uyaxdv('l', 0.1, 0.5)
53
+ DCL::uyaxdv('r', 0.1, 0.5)
54
+
55
+ DCL::grcls
data/extconf.rb CHANGED
@@ -1,15 +1,13 @@
1
- require "rubygems" unless defined?(Gem)
2
1
  require "mkmf"
3
2
  require "rbconfig"
4
- if Config::CONFIG["MINOR"].to_i > 7
5
- $rb18 = true
6
- else
7
- $rb18 = false
8
- end
9
- if $rb18
3
+ begin
10
4
  require "fileutils"
11
- else
5
+ rescue LoadError
12
6
  require "ftools"
7
+ module FileUtils
8
+ def copy(src, dst); File.copy(src, dst); end
9
+ module_function :copy
10
+ end
13
11
  end
14
12
 
15
13
  #dir_config('narray',$sitearchdir,$sitearchdir)
@@ -31,6 +29,9 @@ if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
31
29
  exit(-1)
32
30
  end
33
31
 
32
+ initcfile_default = "init.c.default"
33
+ initcfile = "init.c"
34
+
34
35
  if(xsystem("which cdclconfig"))
35
36
  cflags = `cdclconfig --cflags`.gsub(/\n/, " ")
36
37
  ldflags = `cdclconfig --ldflags`.gsub(/\n/, " ")
@@ -40,8 +41,8 @@ if(xsystem("which cdclconfig"))
40
41
  print "DCL Version: #{dclversion}\n"
41
42
  dclver = dclversion.gsub(/\./,'')
42
43
  dclver = dclver+'0' if dclver.length <= 2 # 53 --> 530 etc
43
- if dclversion < "5.3"
44
- raise "Supported DCL version is 5.3 or later, while you have #{dclversion}"
44
+ if dclversion < "5.2"
45
+ raise "Supported DCL version is 5.2 or later, while you have #{dclversion}"
45
46
  end
46
47
  dclversionmacro = ' -DDCLVER='+dclver
47
48
 
@@ -49,35 +50,8 @@ if(xsystem("which cdclconfig"))
49
50
  $LOCAL_LIBS += ' ' + ldflags
50
51
  $LOCAL_LIBS += ldlibs
51
52
 
52
- gtkversion = `cdclconfig --gtkversion`.chop
53
- if $?.class==Fixnum
54
- status = $?
55
- else
56
- status = $?.exitstatus
57
- end
58
- if status != 0
59
- if ldlibs =~ /gtk/
60
- gtkversion = "1"
61
- else
62
- gtkversion = "no"
63
- end
64
- end
65
- if gtkversion == "no" then
66
- initcfile = "init.c.default"
67
- else
68
- print "**Infomation** compile with gtk+ (ver.#{gtkversion})\n"
69
- if $rb18
70
- FileUtils.copy("grph1_zgpack.c.org","grph1_zgpack.c")
71
- else
72
- File.copy("grph1_zgpack.c.org","grph1_zgpack.c")
73
- end
74
- initcfile = "init.c.gtk"
75
- if ldlibs =~ /-lgdk_imlib/ then
76
- print "**Infomation** compile with imlib_gdk\n"
77
- end
78
- end
79
- fin = File.open(initcfile)
80
- fout = File.open('init.c','w')
53
+ fin = File.open(initcfile_default)
54
+ fout = File.open(initcfile,'w')
81
55
  while(line = fin.gets)
82
56
  fout.puts(line.sub(/DCLVersion/,'"'+dclversion+'"'))
83
57
  end
@@ -85,10 +59,7 @@ if(xsystem("which cdclconfig"))
85
59
  fin.close
86
60
 
87
61
  else
88
- print "**Warning** cdclconfig is not found. Install C version of DCL 5.3 or later\n"
89
- =begin
90
62
  print "**Warning** cdclconfig is not found. Assume C version of DCL 5.2\n"
91
- gtkversion="no"
92
63
  dcllibname = "cdcl52"
93
64
  f2clibname = "f2c4dcl"
94
65
  xlibname = "X11"
@@ -104,15 +75,12 @@ else
104
75
  end
105
76
  $LOCAL_LIBS += " "+libdir+" "+xlibdir
106
77
  $LOCAL_LIBS += " -l"+dcllibname+" -l"+f2clibname+" -l"+xlibname+" -lsocket -lnsl"
107
- =end
78
+
79
+ FileUtils.copy(initcfile_default, initcfile)
108
80
  end
109
81
 
110
82
  if /cygwin|mingw/ =~ RUBY_PLATFORM
111
83
  have_library("narray") || raise("ERROR: narray import library is not found")
112
- if gtkversion == "2"
113
- have_library("ruby-glib2") ||
114
- raise("ERROR: ruby-glib2 import library is not found")
115
- end
116
84
  end
117
85
 
118
86
  create_makefile("numru/dcl_raw")
@@ -126,7 +94,7 @@ oldmkfl.each_line{ |line|
126
94
  when /^distclean:/
127
95
  newmkfl.puts(line)
128
96
  newmkfl.puts("\t\t@$(RM) Makefile.orig")
129
- newmkfl.puts("\t\t@$(RM) init.c grph1_zgpack.c")
97
+ newmkfl.puts("\t\t@$(RM) init.c")
130
98
  else
131
99
  newmkfl.puts(line)
132
100
  end