integer generic
A 2's complement 16 bit long value which is represented in the machine
in the local standard integer length (32 bit for M68k and VAX/VMS).
This allows 16 bit and 32 bit systems to exchange data between programs
which each use the local INTEGER type.
Only 16 bits are actually transferred.
If an attempt is made to pass more than 16 bits, the upper 16 bits are
simply lost, and no error is generated.
Experience shows that using RPC INTEGER where appropriate
(as opposed to RPC LONG or RPC SHORT)
leads to smoother porting of software between systems.
- C
- int
(32 or 16 bit machine)
- Any Pascal
- INTEGER (32 or 16 bit machine)
- FORTRAN
- INTEGER
RPC_REAL32
Real numbers, 32 bit.
These are passed in the local representation
and converted by the RPC system if necessary.
In the future, RPC_REAL48, RPC_REAL64 and RPC_REAL128 may be
supported too.
Consult the documentation for the compiler of your
machine about the floating point number format.
As format conversion may take place in transferring real numbers,
it is possible that small rounding errors occur.
As the ranges of real numbers differ, very small numbers may be
rounded down to zero, and large ones may cause an "overflow"
conversion error.
- C
- float
- Turbo Pascal
- SINGLE
- Other Pascal
- REAL
- FORTRAN
- REAL
Structured Types
STRING
String
Character, string of
A string is a variable length array of characters.
Its declaration in RPCL must specify the maximum number of characters
which are ever going to be passed, so that the compiler knows how much
space to allocate at the receiving end.
With the exceptions noted below, a string is passed as
two parameters,
the first to give the character array, and the second the length.
The first parameter is an array of CHAR.
The second parameter is of type RPC_INTEGER, and indicates the
number of valid characters actually in the string.
- C
-
a string is passed as one paremeter, a pointer to
its first character.
The string is terminated by a '\0' (null) character.
- VAX/FORTRAN
- For this, (options FORTRAN or VAXVMS),
the string is passed as one parameter,
a string descriptor.
This is the standard for VAX/FORTRAN, but not for the
other
VMS languages.
[In the client, to call a procedure with a string
parameter from VAX/Pascal, it is necessary to include the %STDESCR
before the parameter to force FORTRAN conventions, but then any Pascal
string or varying of char can be passed.
In a server, in order to write a
Pascal procedure which takes a string parameter, it is necessary to declare
the parameter
as a RECORD with the string descriptor format, and explicitly access the
length and pointer within it.
See the VAX/VMS manual for
futher details.]
The length field of a string descriptor is never changed. If an OUT string
has a different length from the receiving descriptor on the client,
it is truncated or
blank filled.
On the server, for an IN parameter, a descriptor is generated
the same length as the client's string.
The string should be declared in the RPCL with a length greater than or
equal to the maximum string size which will ever be used for that parameter,
in the client or in the server.
- M6809/TurboPascal
-
On the M6809, and under TurboPascal,
the string is passed as a single STRING argument, a byte array
with the current length in position 0 and the characters in positions
1 to , with a maximum length of 126.
The figure of 80 below is used only as an example: the only upper limit
imposed by the RPC system is 32767.
- RPCL
-
TYPE mystring IS STRING(80);
PROCEDURE proc_name(..; thestring: IN OUT mystring; ...);
- C
-
typedef char mystring[81];
proc_name(..., the string, ...);
...
mystring thestring;
- Pascal
-
TYPE mystring = PACKED ARRAY [1..80] OF CHAR;
PROCEDURE proc_name(...
VAR s: mystring,
VAR l: RPC_SHORT, ..);
- VAX/Pascal
-
In client:
TYPE mystring = PACKED ARRAY [1..80] OF CHAR;
{ or VARYING OF CHAR }
PROCEDURE proc_name(... VAR s: %STDESCR mystring; ...);
EXTERN;
In server:
TYPE mystring = PACKED ARRAY [1..80] OF CHAR;
descriptor = RECORD
strlen: [word]0..80;
dum1, dum1: [byte] 0..255;
stradr: ^mystring
END;
PROCEDURE proc_name(... VAR d: descriptor; ...);
BEGIN
...
END;
- FORTRAN
-
SUBROUTINE PROC_NAME(..., THESTRING, ...)
CHARACTER *(*) THESTRING
- Omegasoft Pascal, TurboPascal
-
TYPE mystring = STRING[80];
PROCEDURE proc_name(... VAR s: mystring);
SUBSTRING
The substring type has been introduced to allow a more efficient implementation
of the PILS remote host interface. A substring is a
packed array of char in which the valid characters are between two indices. The
first index, START, indicates the first valid element in the array, while the
second, LENGTH, indicates the number of valid characters that follow (and
including) the START.
- RPCL
-
TYPE mysub IS SUBSTRING(80);
PROCEDURE proc_name(..; mysubstring : IN OUT mysub; ...);
- C
-
typedef char mysubs[80]
proce_name(..., a_thesubs, s_thesubs, l_thesubs, ...)
...
mysubs a_thesubs;
int *s_thesub, *l_thesub;
...
- Pascal
-
TYPE mysub = PACKED ARRAY [1..80] OF CHAR;
PROCEDURE proc_name(.., VAR thesub: mysub;
VAR start, len: RPC_INTEGER, ...);
ARRAY
A sequence of SIMPLE type like RPC_CHAR or RPC_LONG.
It may be multidimensional
and must have a specified size for each dimension.
(Note that the example below, although illustrating
different aspects of array types, would in practice
be too big for the limit currently imposed by the runtime support
of about 1450 bytes per call.)
- RPCL
-
TYPE myarray IS array (1..256, -15..23, 10..15) of rpc_long;
PROCEDURE proc_name(..; the_array: IN OUT myarray; ..);
- C
-
typedef int myarray[256][39][6]
- Pascal
-
TYPE myarray = ARRAY [1..256, -15..23, 10..15] OF INTEGER;
PROCEDURE proc_name(.. VAR a: myarray; ...);
- FORTRAN
-
SUBROUTINE PROC_NAME(..., IARRAY, ..)
INTEGER IARRAY(256, 39, 6)
-
Arrays of the same sizes on different machines are compatible,
even if the starting index is not the same.
For example, a FORTRAN array(1..10) may
be passed to a C array(0..9).
Arrays are of fixed length:
the same amount of data is transferred every time.
An array which contains a varying
amount of dat
should be described as a sequence.
(Under VAX/FORTRAN, ARRAY type cannot be used to pass arrays of
CHARACTER. Use the STRING type instead).
SEQUENCE
A sequence is a general variable&hyphen.length array.
It represents a one&hyphen.dimensional collection of data, whose type
and maximum number are specified at compile time but whose
actual number and value are specified at run&hyphen.time.
A sequence is always passed as two parameters, a length and an array,
although it is specified in RPCL as one logical parameter.
- RPCL
-
TYPE myseq IS sequence (80) of rpc_long;
procedure proc_name(..; theseq: IN OUT myseq; ...);
- C
-
typdef int myseq[80];
proc_name(..., a_theseq, l_theseq, ...);
...
myseq a_theseq;
int * l_theseq;
...
- Pascal
-
TYPE myseque = ARRAY [1..80] OF INTEGER;
PROCEDURE proc_name(...
VAR thearr: myseq;
VAR thelen: INTEGER; ...);
- Fortran
-
SUBROUTINE PROC_NAME( ..., THESEQ, THELEN, ...)
INTEGER THESEQ (80)
INTEGER THELEN
-
Note that under VAX/VMS, for a SEQUENCE(...)OF RPC CHAR,
the array must be a pure array: it may not be a FORTRAN string passed by
descriptor. If a FORTRAN string is used in the client, it must be passed
with a %REF qualifier. A FORTRAN string cannot be used for
the array in the called routine.
The STRING type (above) is available for passing strings, although
with FORTRAN this will result in the entire length of the string
being passed every time, as FORTRAN strings are fixed length.
RECORD
A record is a data structure consisting of a set of named fields.
- RPCL
-
TYPE myrec IS
RECORD
field1: RPC_INTEGER;
field2: RPC_INTEGER;
END RECORD;
- Pascal
-
TYPE MYREC =
RECORD
FIELD1: INTEGER;
FIELD2: INTEGER;
END;
VAR X: MYREC;
- C
-
struct {
int field_1;
int field_2;
} myrec;
struct myrec x;
- VAX/FORTRAN
-
STRUCTURE /MYREC/
INTEGER FIELD1
INTEGER FIELD2
END STRUCTURE
RECORD /MYREC/ X
- PILS
- (There is no concept of records in PILS.)
Pointers
A pointer type, if explcitly declared as such,
is assumed to be NIL (null) or to point to valid data.
In the later case, the data is transfered to the other side,
and a pointer to it is generated.
This will occur recursively, so that linked lists and trees
may be passed. Self-referencial data structues (circular lists etc)
are not allowed.
For an INOUT parameter, the called routine may modify the structure.
On the client side, the RPC system completely destroys the structure
(returning it to the heap) and rebuilds (from the heap) the structure
returned from the server.
For IN parameters, the RPC system does not touch the structure
or pointer on the client side at all.
For OUT parameters, the RPC system allocates a new structure on the
client side, and it is the responsability of the caller eventually to
return it to the heap.
The original value of the pointer is ignored, and simply overwritten with
a pointer to the new structure.
- RPCL
-
TYPE mypo IS ACCESS myrec;
- Pascal
-
TYPE mypo = ^myrec;
- C
-
typedef struct myrec *x;
- FORTRAN
- There is no concept of pointer in FORTRAN.
- PILS
- There is no concept of pointer in PILS.