Procedure 9

Read Spectrum

capability

 

pathname length

 

pathname

 

cookie

count

base1

base2

:

base8

range1

range2

:

range8

size1

size2

:

size8

arraytype

REQUEST

If the access capability is valid and the spectrum defined by pathname exists then returns count items of data from the spectrum.
The fields are as defined in the document EDOC061. Undefined fields should be set to -1 or all one bits.
The elements of the arrays base, range, and size defined must be consistent with the dimension of the spectrum.
If size are undefined then it is assumed that no scaling of the data is required and the spectrum is returned as it would be if size were equal to range.
Use array number = 1 to access the spectrum and = 2 to access the error spectrum.

The arrays base and range define a region of counts within the spectrum to be returned and the counts may then be considered to form a sequence of data items of size given by the type of the spectrum array. Counts are returned starting at offset data items into the defined region. The first data item is at offset zero.

The data returned is scaled such that the region defined by base and range is returned in an array defined by size and arraytype.

success = 0

flag

data length

 

data

 

RESPONSE - success

The data is returned in the array data.

The least significant bit of flag is used by the server as a data format bit to indicate the format of the data returned.
The remaining bits of flag will normally be set to zero but will be set to one if truncation/overflow occurred while scaling the data in order to return it within the array requested and/or in the type requested.

0

data is big endian (i.e. Sparc)

1

data is little endian (i.e. Intel x86)

data format bit

procedure status

RESPONSE - failure

procedure status which is non zero indicates the cause of the failure.

3

invalid capability

4

invalid pathname

5

invalid parameter value

6

pathname not a spectrum

procedure status

XDR Specification

procedure   ReadSpectrum (cap, path, number, offset, count, bse, rng, s, type)
                 returns(reply)
            capability   cap;
            pathname   path;
            unsigned   number;
            unsigned   offset;
            unsigned   count;
            base   bse;
            range   rng;
            size   s;
            arraytype   type;

            union switch (stat status)  {
                OK:
                unsigned   flag;
                string   data <>;
                default:
                struct   {}
            }  reply;

Implementation

Spectra data may exist with the data in either big endian format (that is as used by SunMicrosystems Sparc and Motorola processors) or in little endian format (as used by Intel processors of the x86 family and Digital). Data is passed from the server to the client as an opaque data stream for reasons of efficiency and thus the format of the data must be returned by the server to the client.
In the case of disc based spectrum which may exist in either format for a given server the server can use the magic number in the spectrum header (which is available to it but not the client) together with knowledge of its processor type to determine the endian format of the spectrum.
All other information based between the server and client (including the data format bit in the flag field) will be handled by the XDR encodeing and hence will not appear dependent on processor architecture.
See also corresponding handling in the Write Spectrum and Create Spectrum procedures.