Documentation:Reference:TDI C1 - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

CALL=IMAGE->ROUTINE[:KIND]([X],...)

MDS Operation. Invoke a routine from a sharable image with arguments.

Usual Form image->routine:kind([arg],...)

or image->routine([arg],...).

Function Form BUILD_CALL([KIND],IMAGE,ROUTINE,[ARG],...).

If IMAGE or ROUTINE is an expression use BUILD_CALL.
Then for KIND use KIND(1.2) as an example.

Normally, DATA(arguments) is taken and text is passed by
descriptor and other types are passed by reference as in
Fortran. The default methods can be overridden by using
VAL(x), REF(x), DESCR(x), or XD(x), with x as argument.

Arguments Optional: KIND, X,....

KIND

byte unsigned scalar of data type returned. Valid data types are:

symbol (id) ctype comment
MISSING (0) void ignores return value
P (51) void* generic pointer
DSC (24) mdsdsc_t* (struct descriptor*) pointer to proper MDSplus descriptor
BU, WU, LU, QU uint8_t, uint16_t, uint32_t, uint64_t unsigned integers
B, W, L, Q int8_t, int16_t, int32_t, int64_t signed integers
FS, FT float, double single/double precision real
FSC float[2] single precision complex
NID nid_t (int) node identifier
T, PATH, EVENT char[] stack or static null-terminated string
C (56) char* dynamically allocated null-terminated string

WARNING: other types are not (yet/fully) supported and should not be used.

IMAGE

character scalar. Forced to uppercase for VMS. It must be a simple filename in SYS$SHARE or a logical name.

ROUTINE

character scalar. Forced to uppercase for Linker.

X,...

arguments to the routine.

WARNING: The order of evaluation may be random.

WARNING: Data should be explicitly casted to the data type expected by ROUTINE (memory violation may result if type is mismatching).

WARNING: If the argument is an indicated variable like XD(_A), DESCR(_A), or REF(_A), the variable can be changed. This allows programs to return scalars, arrays, or complex descriptions BUT CAN CLOBBER YOUR MEMORY.

An expression can be changed but is thrown away.

Error... TDI$_INVDTYDSC data type is greater than one long word
and is not FT or FC.

Result.. Routine dependent. The result KIND must be specified if
it is not L.

Examples. MTHRTL->MTH$SIND:F(30.) is 0.5 and
_A=0, TDISHR->TDI$SIND(XD(30.),XD(_A)) is 1 for success
and sets variable _A to 0.5.

See also EXT_FUNCTION to do command files and define-and-go FUNs.

DESCR (X)

CALL mode. Pass the data of the argument by descriptor.
Argument. X is any type, scalar or array that DATA can evaluate.
Use..... Descriptor of VMS data, like Fortran %DESCR(1.23).
The descriptor of the DATA of the argument. For X alone, non-data forms may be passed. May programs cannot handle these forms.

REF (X)

CALL mode. Pass the data of the argument by reference.
Argument. X is any type, scalar or array that DATA can evaluate.
Use..... Starting address of VMS data, like Fortran %REF('123').
The address of the DATA of the argument. For X alone, non-data forms may be passed. May programs cannot handle these forms. The REF form is expected by most Fortran routines but the DESCR form is used for characters.

VAL (X)

CALL mode. Pass the data of the argument by value.
Argument. X is any type, scalar or array that DATA can evaluate.
Use..... Integer scalar like a CC call or Fortran %VAL(123). The
value of the DATA of the argument used like an address.

XD (X)

CALL mode. Pass the data of the argument by extended descriptor.
This is the only form that can pass signals and other class-R described data.
Argument. X is any VMS or MDS type that can be EVALUATED.
Use..... Only routines written with MDS calls can use these descriptors.

CASE (X,STMT,...)

CC-F90 Modified Statement. Do statement if SWITCH test matches value.
Required Usual Form CASE (X) STMT.
>>>>>>>>>WARNING, the parentheses are required here, unlike in C.
Note F90 uses SELECT CASE (X) ... END CASE.
Function Form CASE(X,STMT,...). May be syntatically invalid.

Arguments
X any comparison scalar or scalar range.
The range must not be stepped but may be open ended.
For example, 4, 4:, :6, and 4..6 are acceptable.
STMT statement simple or {compound} or multiple.

Result.. None.

Example. SWITCH (_k) {
CASE (1) _j=_THING1; BREAK;
CASE (4.5:5.5) _j=_OTHER_THING; BREAK;
CASE DEFAULT ABORT();
}.

CEILING (A)

F90 Numeric Elemental. The smallest whole number not below the argument.

Argument. A must be integer or real. Complex numbers are an error.

Signals. Same as A.
Units... Same as A.
Form.... Same as A.

Result.. For integral A, no change. AINT(A) if A>0, A if A<0 and
A==AINT(A), else AINT(A)-1.
>>>>>>>>>WARNING, F90 returns integer form.

Examples. CEIL(2.783) is 3.0. CEIL(-2.783) is -2.0.

CHAR (I,[KIND])

F90 Character Elemental. The character in a specified position of the
processor collating sequence. The inverse of the ICHAR.

Argument. Optional: KIND.
A integer.
KIND scalar integer type number, for example, KIND(' ').
(Today only one text type is supported.)

Signals. Same as I.
Units... Same as I.
Form.... Length-one character of same shape.

Result.. Type KIND if it is present, else character.
The character in position I of the processor collating
sequence. ICHAR(CHAR(I)) is I for 0<=I<=n-1 and
CHAR(ICHAR(C)) is CC for any representable character.
It is truncated to 8 bits on the VAX.

Example. CHAR(88) has the value 'X' on the VAX.

CLASS (A)

MDS/VMS Operation. Class of data storage descriptor.

Argument. A may be any descriptor.

Result.. Byte unsigned of the descriptor class.
Descriptor data types (DSC$K_DTYPE_DSC) are removed.
Use CLASS for data class without NID, PATH, or variable.
Use CLASS_OF for data class including them.

Examples. CLASS(3) is 1BU (DSC$K_CLASS_S) and
CLASS([]) is 4BU (DSC$K_CLASS_A).
CLASS(_A) is the class of the value in variable _A).

CLASS_OF (A)

MDS/VMS Operation. Class of data storage descriptor.

Argument. A may be any descriptor.

Result.. Byte unsigned of the descriptor class.
Descriptor data types (DSC$K_DTYPE_DSC) are removed.
Use CLASS for data class without NID, PATH, or variable.
Use CLASS_OF for data class including them.

Examples. CLASS_OF(3) is 1BU (DSC$K_CLASS_S) and
CLASS_OF([]) is 4BU (DSC$K_CLASS_A).
CLASS(_A) is 1BU (DSC$K_CLASS_S).

CMPLX (X,[Y],[KIND])

F90 Conversion Elemental. Convert to complex type.

Arguments Optional: Y, KIND.
X numeric.
Y numeric. Default is zero.
KIND scalar integer type number, for example, KIND(1d0).
Default is compatible form of X and Y.

Signals. Single signal or smaller data.
Units... Single or common units, else bad.
Form.... Complex. If KIND present, the complex type KIND;
otherwise, the complex type of X and Y.
The compatible shape of X and Y.

Result.. Type KIND if it is present, else complex of
compatible type of X and Y.
If Y is absent and X is not complex, it is as if Y were
present with value zero. If Y is absent and X is
complex, it is as if Y were present with the value
AIMAG(X). If both are present, the real parts of X and Y
are used. If KIND is absent, it is ignored; otherwise,
CMPLX(X,Y,KIND) has real part REAL(X,KIND) and imaginary
part REAL(Y,KIND).
Immediate at compilation.
>>>>>>>>>WARNING, truncation does not cause an error.

Examples. CMPLX(-3) is CMPLX(-3.0,0.0). CMPLX(3,4,5d6) is
CMPLX(3d0,4d0).

COMMA (A,B...)

CC Operation. Evaluate arguments, keep only last.
Usual Form. A,B,... .
Function Form. COMMA(A,B,...).

Arguments May be any expressions. Note that used as an argument of
a function, it must be parenthesized.

Result.. That of the last argument.

Example. _A=5,_B=6,_A+_B is 11 with variables _A and _B set.

COMPILE (STRING,[ARG],...)

Compile Operation. Convert a text string into a functional form of the
expression with the possibility of including other
descriptors. Comments (/* ... */) are removed and may be
nested. Comments cannot be recovered by DECOMPILE.
Arguments Optional: ARG,... .
STRING character scalar.
ARG,... other expressions that may be accessed as $k where k
runs from 1 to the number of additional arguments.
dep | dep Is logical OR of dependencies.
( dep ) Allows grouping.
Immediate at compilation.

See also. DECOMPILE_DEPENDENCY to interpret the expression.

COMPILE_DEPENDENCY (STRING)

Compile Opertion. Convert a text string into functional form of the dependency.
No embedded comments are allowed.
STRING character scalar.

COMPLETION_OF (A)

MDS Operation. Get the completion field.

Argument. Descriptor as below.

Result.. DISPATCH_OF(A) is searched for this:
DSC$K_DTYPE_DISPATCH, the completion field.
Otherwise, an error.

COMPLETION_MESSAGE_OF (A)

MDS Operation. Get the completion field.
Argument. Descriptor as below.

Result.. A is searched for this:
DSC$K_DTYPE_ACTION, the completion_message field.
Otherwise, an error.

CONCAT (STRING_A,STRING_B,...)

Character Elemental. Concatenate text.
Usual Form STRING_A // STRING_B ... .
Function Form CONCAT(STRING_A,STRING_B,...).

Arguments Must be character. Limit 253 character expressions.

Signals. The single signal or the smallest.
Units... The single or matching units, else bad.
Form.... Character of compatible shape with lengths summed.

Result.. The element-by-element concatenation of text elements
STRING_A, STRING_B, ... .
Note: compiled adjacent text strings are concatenated.
Immediate at compilation.

Example. "ABC" // 'DEF' is "ABCDEF"