Defines | |
#define | SUN_OK 0 |
No error. | |
#define | SUN_EOS 1 |
End of stream. | |
#define | SUN_IMPL_ERROR 2 |
Implementation-specific. | |
#define | SUN_NO_RESOURCE 3 |
Resource not found. | |
Functions | |
DC_RT_FMAC1 void * | sun_write_init (void *implementation, const char *sun_id, unsigned long *len) |
Prepares a storage unit for stream writing. | |
DC_RT_FMAC1 void * | sun_read_init (void *implementation, const char *sun_id) |
Prepares an existing storage unit for stream reading. | |
DC_RT_FMAC1 int | sun_stream_read (void *in_stream, char *buf, unsigned long *size) |
Performs a stream reading operation. | |
DC_RT_FMAC1 int | sun_stream_write (void *out_stream, const char *buf, unsigned long *size) |
Performs a stream writing operation. | |
DC_RT_FMAC1 int | sun_get_error (void *stream) |
Retrieves an implementation-dependent error code. | |
DC_RT_FMAC1 int | sun_close (void *stream) |
Close a reading or writing context. |
Although it could be used implemented on other implementations than regular files the Storage UNit layer is implemented by default on 'stdio'.
#define SUN_OK 0 |
No error.
#define SUN_EOS 1 |
End of stream.
#define SUN_IMPL_ERROR 2 |
Implementation-specific.
#define SUN_NO_RESOURCE 3 |
Resource not found.
DC_RT_FMAC1 void* sun_write_init | ( | void * | implementation, | |
const char * | sun_id, | |||
unsigned long * | len | |||
) |
Prepares a storage unit for stream writing.
If the id is not known by the implementation, a new storage unit is created, else it is overwritten. A fixed size can be asked for the storage unit.
implementation | A pointer on the SUN implementation. Reserved for later use (using NULL will select the default implementation on top of the stdio lib meaning that sun_id will stand for a filename). | |
sun_id | Storage unit implementation-dependent unique id. | |
len | If specified, a fixed-length storage unit is required and the granted length is returned. If NULL is supplied, an unspecified length is required. |
DC_RT_FMAC1 void* sun_read_init | ( | void * | implementation, | |
const char * | sun_id | |||
) |
Prepares an existing storage unit for stream reading.
implementation | A pointer on the SUN implementation. Reserved for later use (using NULL will select the default implementation on top of the stdio lib meaning that sun_id will stand for a filename). | |
sun_id | Storage unit implementation-dependent unique id. |
DC_RT_FMAC1 int sun_stream_read | ( | void * | in_stream, | |
char * | buf, | |||
unsigned long * | size | |||
) |
Performs a stream reading operation.
Reads bytes from the storage unit from the position it has been stopped by the previous read operation and if possible the number or requested bytes.
in_stream | A SUN input stream. | |
buf | The byte buffer where the read data is copied. | |
[in,out] | size | The size of the buffer is initially passed and the actual read data is returned. |
DC_RT_FMAC1 int sun_stream_write | ( | void * | out_stream, | |
const char * | buf, | |||
unsigned long * | size | |||
) |
Performs a stream writing operation.
Writes bytes contained in the passed buffer after the bytes passed the previous read operation and if possible the number or requested bytes.
out_stream | A SUN output stream. | |
buf | The byte buffer where the data to write is stored. | |
[in,out] | size | The size of the buffer is initially passed and the actual written data is returned. |
DC_RT_FMAC1 int sun_get_error | ( | void * | stream | ) |
Retrieves an implementation-dependent error code.
To use after an SUN_IMPL_ERROR error code has been returned by a SUN API.
stream | A SUN stream. |
DC_RT_FMAC1 int sun_close | ( | void * | stream | ) |
Close a reading or writing context.
stream | A SUN stream. |