The scm module
Scm module is an Scheme interpreter based on SCM. The first input (init) is a string and should contain the initialization file of scm. This will probably be "/usr/local/lib/scm/Init5d6.scm" depending the location and the version of your libscm.a. The second input (prog) should be the path and name of a scheme file containing your program. This file is evaluated the first time OpenDX run the module In the case this file is modified, it will be evaluated again before the next execution of the interpreter. The third input should be a scheme command which will be executed each time scm is called. The following inputs can be any kind of data coming from OpenDX and will be converted into scheme lists and stored in the global *in* variable by the (get-dx-input ) function. More input entries can be added by first selecting the scm module and then by pressing "Ctrl+A" or selection "Add input tab" in the Edit->Input/output Tabs.
Results of the program should be stored in the *out* global variable and then converted into output data using (set-dx-output ). More output can be added by first selecting the scm module and then by selecting "Add Output Tab" in the Edit->Input/output Tabs.
Print the string to OpenDX message window.
note: dxmessage cannot display strings longer than 255 characteres.
Import input fields into the *in* global variable.
Export *out* global variable into the output fields
Tell OpenDX that DXScm module still have work to do and the command string should be evaluated again.
The *in* global variable contains the value of input fields. Its structure is a list where each element correspond to each input entry. Depending of the type of the inpout entry, the value can be a single value in case of string, integer, scalar, or a list in case of an array or a field.
If input contains the scalar 0.3 and input1 contains a field
with two components:
a positions component with 5 values and a data component with 5 values dependant of the positions, then after the call to (dx-get-input ), *in* will contain the value:
'( 0.3 (("positions" (( 0.1 0.2 0.3) (0.2 0.3 0.4) ... )) ("data" ((1) (2) ... ))))
... to be continued ...
The *out* global variable contains the value to export by (set-dx-output). Its structure is the same with the one of *in*.
(set! *out* (list (list (list "positions" (list (list 0.0 0.1 0.2) (list 2.0 2.1 2.3) (list 3.0 3.2 3.1)))
(list "data" (list (list 1) (list 2) (list 3)) "dep" "positions")) 10.2 3)) (set-dx-output )
will create a field in the first output containing 2 components: an array named positions and an array named data. The positions array is a 2 dimensional array of size 3 by 3 and each element are float. The data array is a one dimension array containing integers. the "dep" "positions" indicates that these values are dependent of the array positions. They can be rendered as 3 spheres with different radius using "AutoGlyth". The second output will be a scalar and the third one will be an integer.
note: The type of the elements in the array is defined from the first element. All values in the same array should have the same type. This is not yet tested by set-dx-ouput and different types can results in a segmentation fault.
|last update: 29/05/03|