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.
You can install ruby-dcl by
$ gem install ruby-dclBut to do that requires to install the C version of DCL beforhand.
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.
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::DCLafter the "require" statements above. Then it becomes ok to type simply as:
gropn( iws )You can instead include the module half way:
include NumRuto 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.sgqvptand 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.sgqvptBy 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==nRuby:
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).