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.
In your Ruby program, you first need to put the following line to load this library:
require "numru/dcl"
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
of NumRu::DCL.
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
include NumRu::DCL
after the "require" statements above. Then it becomes ok to type simply
as:
gropn( iws )
You can instead include the module half way:
include NumRu
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
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
call sgqvpt(vxmin,vxmax,vymin,vymax)
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 whatever. Therefore,
call ueqtlv(tlev1,tlev2,ipat,iton)
in Fortran is
ary = NumRu::DCL.ueqtlv(iton)
or
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
eliminated):
call usgrph(n, x, y) ! here x and y are 1D arrays with length==n
Ruby:
NumRu::DCL.usgrph(x, y)
Note that the Ruby usgrph makes sure that the arrays x and y have
the same length. Exception is raised if they differ.
in English (Currently only reference manuals are available. Tutorials will be translated in future)
Image gallery / Sample prgrams : Demo programs included in the Ruby/DCL distribution indexed by images!
New features of DCL 5.3. See also the new demo programs [dennou-ruby:001908] (in Japanese).
% tar xvzf dcl-5.3.3.tar.gz
% cd dcl-5.3.3-C
% ./configure
% make
% make install
You can check whether you have a GTK, and which of the two you have with terminal commands as follows:
% pkg-config gtk+-2.0 --modversion
This prints the version of GTK2 if it is
installed.
% pkg-config gtk --modversion
or
% gtk-config --version
Note that gtk-config is covers
only GTK1 (not GTK2).
Install it as follows:
% tar xvzf ruby-dcl-version.tar.gz
% cd ruby-dcl-version
% ruby extconf.rb
% make
% make site-install
NOTE: (Read this if you have installed NArray to a non-standard
directory -- not recommended)
% setenv WITH_NARRAY_INCLUDE '--with-narray-include=/narraydir/include'
or, if you are using bash,
% export WITH_NARRAY_INCLUDE='--with-narray-include=/narraydir/include'
This cause src/extconf.rb run with its value as: (none, currently)
)