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.
- 2016/07/17 Ver 1.8.1 released: supported numru-narray
- 2016/06/22 Ver 1.8.0 released: support DCL 7.0.0 (added new
methods DCL::swslft, DCL::swlsft, DCL::swflsh).
- 2015/03/18 Ver 1.7.1 released: minor update for compilation
- 2015/01/27 Image gallery / Sample prgrams updated for ruby 1.7.0 (includes full color demo: uipack in gpph2)
- 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)
You can install ruby-dcl by
$ gem install ruby-dcl
But to do that requires to install the C version of
If you want to have NumRu::DCL use numru-narray (NumRu::NArray,
seiya's 64-bit version of NArray),
install it in advance and set the environmental variable
NARRAY_TYPE as "numru-narray" (if bash, export NARRAY_TYPE=numru-narray).
And then install this libray by "gem install ruby-dcl" as described above.
Othewise, narray (the original masa's NArray, not Numo::NArray) is used.
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.
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.