HOME: dennou ruby home page
by T. Horinouchi, K. Kuroi, K. Goto, S. Nishizawa and T. Koshiro
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.
- 2015/01/27 Image gallery / Sample prgrams updated for ruby 1.7.0 (includes full color demo: uipack in gpph2)
- 2015/03/18 Ver 1.7.1 released: minor update for compilation
- 2012/04/25 Ver 1.7.0 released:
- DCL 5.4.5 support (that include a new package uipack and
its demo programs)
- 2011/08/11 Ver 1.6.3 released: Licence file added (BSD 2-clause)
- 2011/02/24 Ver 1.6.2 released:
- Corrected an packaging miss in ver 1.6.1. The contents
are the same.
- 2011/02/24 Ver 1.6.1 released:
- DCL 5.3.4 support (that include a new method uetonb and
its demo programs)
- Ruby 1.9.2 support
- 2008/07/17 Ver 1.6.0 released:
- 2006/12/01 Ver 1.5.3 released: Mac X and CDCL 5.3.2 support.
- If you use 5.3.2 or later version, you can set DCL
parameters as command-line options (e.g., -sw:ldump=true).
- 2005/11/17 Ver 1.5.2: enhancement in gtk support (added DCL.zgq*)
- 2005/08/03 Added a colormap list
- 2005/08/02 Added image gallery / sample prgrams
- 2005/05/13 Ver 1.5.1: Supports Mac OS 10.3 (& 10.2)
- 2004/11/11 Ver 1.5.0: supports both DCL-5.2-C and DCL-5.3-C.
debug for SHTLIB.
- 2004/07/15 Ver 1.4.1: Update only for windows(cygwin/mingw).
No difference from 1.4.0 for other platforms.
- 2004/03/05 Ver 1.4.0: Supports GTK2 in addition to GTK1
- 2004/01/19 Ver 1.3.2 -- debug in math2/shtlib
- 2003/12/10 Ver 1.3.1 -- very minor debug (use it
if compilation failed on Windows).
- 2003/09/23 RubyDCL (1.3.0) now accepts NArrayMiss
(by internally calling NArrayMiss#to_na(DCL.glrget('rmiss')))
- 2003/08/27 RubyDCL (1.2.2) now works with Ruby 1.8.0
- 2003/06/10 RubyDCL now supports the type independent
parameter set/get functions such as sgpset, uspget,
in addition to the type specific ones such as sgrset,
usiget and gllstx. The generic ones are made possible
by writing in Ruby.
The RubyDCL "p" set/get functions include the string set/get
functions such as uscset.
- 2003/06/10 GTK support (by S Nishizawa) is merged in --
RubyDCL works fine either with the standard DCL or GTK+ powered DCL.
(see here to get the DCL libraries)
First install this library and "NArray" following
the install section.
In your Ruby program, you first need to put the following line
to load this library:
Now RubyDCL is loaded as a module named NumRu::DCL. All the subroutines and
functions in the original DCL are now available as the module functions
Therefore, they are normally used with the prefix NumRu::DCL.,
i.e., the function gropn is used as
NumRu::DCL.gropn( iws )
If it is cumbersome to type the prefix each time, you can "include" the
module by putting
after the "require" statements above. Then it becomes ok to type simply
gropn( iws )
You can instead include the module half way:
to eliminate only NumRu but retains DCL:
DCL.gropn( iws )
We recommend either not to include the module at all or to include only
NumRu. Then you place the prefix DCL. to all the DCL methods. This would
make it easy to find calls to DCL functions in ruby programs, so it will
make your program readable.
Calling sequence of the module functions are identical to those of the
corresponding functions and subroutines, except that
The second point would need to be clarified further. For example,
- The word "call" for Fortran subroutines is not used.
- Return variables of a Fortran subroutine are returned as return
values of the corresponding Ruby method, not as arguments.
- Arguments to express array sizes are eliminated.
call sgrget(paramname, paramvalue)
in Fortran becomes
paramvalue = NumRu::DCL.sgrget(paramname)
in ruby (again, the prefix NumRu:: can be omitted if you include
NumRu). If there are multiple return arguments in a function, they are
packed in an array (of the predefined class Array), so that
in Fortran becomes
ary = NumRu::DCL.sgqvpt
and ary becomes an array holding the four elements, vxmin, vxmax,
vymin, and vymax. It can also be written as
vxmin,vxmax,vymin,vymax = NumRu::DCL.sgqvpt
By this vxmin etc are properly set.
A ruby array can contain any objects as elements, so they can be a mixture
of, for example, strings and numeric values and other arrays of
in Fortran is
ary = NumRu::DCL.ueqtlv(iton)
tlev1,tlev2,ipat = NumRu::DCL.ueqtlv(iton)
in ruby, where tlev1 and tlev2 are Float and itpat is an Integer.
The following is an example of third point (array-size arguments are
call usgrph(n, x, y) ! here x and y are 1D arrays with length==n
Note that the Ruby usgrph makes sure that the arrays x and y have
the same length. Exception is raised if they differ.
- Dependent softwares. Install these in the following order:
Ver 1.6 or later.
NArray: a multi-dimensional numeric array class for ruby.
Required version: ver 0.5.5 or later.
NArrayMiss (OPTIONAL BUT STRONGLY RECOMMENDED):
multi-D numeric array with missing data (dependent
- The C version of the DCL (5.3.3 or later versions):
Ver 188.8.131.52 or later versions are recommended.
% tar xvzf dcl-184.108.40.206-C.tar.gz
% cd dcl-220.127.116.11-C
% make install
- (OPTIONAL): You can use GTK-powered versions of dcl-C as
your graphic engine.
GTK is a
toolkit for creating graphical user interfaces. It
has two major different versions, GTK (=ver.1;
GTK1 hereafter) and GTK2.
You can use any of them (GTK2 is recommended).
Install related libraries in the following order:
- If you do not have, install GTK1 or GTK2 (before
installing the C version of DCL). GTK is bundled in
most linux distributions, but if you are using
Windows, you need to install it.
You can check whether you have a GTK, and which
of the two you have with terminal commands as follows:
- Install the C version of DCL (see the install description).
It will automatically configures whether or not
you have GTK, and which of GTK1 and GTK2 you have.
- Install a Ruby wrapper of GTK. Use
for GTK2, and use
Ruby-GNOME for GTK1. Note that the latter is obsolete.
the homepage of gave for example.
- Installation of this library.
Install it as follows:
% tar xvzf ruby-dcl-version.tar.gz
% cd ruby-dcl-version
% ruby extconf.rb
% make install
NOTE: (Read this if you have installed NArray to a non-standard
directory -- not recommended)
By default, the two headers narray.h and narray_config.h
in the narray package are assumed to have been copied to
$(sitearchdir), which is normally
/usr/local/lib/ruby/site_ruby/1.6/$(arch)/ if you are using Unix,
where $(arch) is something like sparc-solaris2.6, a combination of
CPU and OS. When you install RubyDCL,
you can specify the directory that contains these files
explicitly by using an environmental variable WITH_NARRAY_INCLUDE
% setenv WITH_NARRAY_INCLUDE '--with-narray-include=/narrayincdir'
or, if you are using bash,
% export WITH_NARRAY_INCLUDE='--with-narray-include=/narrayincdir'
This cause src/extconf.rb run with its value as:
cd src; ruby extconf.rb --with-narray-include=/narrayincdir;
The source code of RubyDCL id created by from a prototype definition of
DCL using a ruby program proto2c.rb in the top directory. The prototype
definition is in a format specific to this converter -- It is not enough
to collect subroutine/function definition from the Fortran code, since
we cannot distinguish input, output, in-out, and work space arguments. It
is also not possible to get this information from the C version, since
it is created automatically from the Fortran library by f2c.
As a result, the prototype definition used in this library has to be
updated by hand if the original library is updated.
Takeshi Horinouchi ()
GFD Dennou Club:
Copyright (C) GFD Dennou Club, 2000, 2001. All rights reserved.