 |
Application I/O Functions |
|
Contents
[back to top]
E.1 Introduction
This appendix contains the specifications of the application I/O (applio) functions which can be implemented to replace or extend the normal part file handling functions in the Frustrum. These functions are used during input and output of transmit files with 'application i/o' format.
There is further information on the use of the application i/o functions in the "Application I/O" section under "File formats" in Chapter 2, "File Handling".
[back to top]
E.1.1
Registering the application I/O functions
The application i/o functions must be registered with Parasolid by calling the PK function PK_SESSION_register_applio, before the Parasolid session is started.
Note: In the following function definitions, the function names given are purely nominal, as the functions are registered by the call to PK_SESSION_register_applio.
|
open_rd
int open_rd
(
int keylen,
const char* key,
int *strid
)
|
Opens a file for reading with the given key. The
strid
returned identifies the file in later read/write operations.
Valid function returns are FR_no_errors, FR_not_found, FR_open_fail.
open_wr
int open_wr
(
int keylen,
const char* key,
int *strid
)
|
Opens a new file for writing with the given key. The
strid
returned identifies the file in later read/write operations.
Valid function returns are FR_no_errors, FR_already_exists, FR_disc_full, FR_open_fail.
open_uc_rd
int open_uc_rd
(
const PK_UCHAR_t *key,
int *strid
)
|
Opens a file for reading with the given Unicode key. The
strid
returned identifies the file in later read/write operations. Valid functions returns are FR_no_errors, FR_not_found, FR_open_fail.
open_uc_wr
int open_uc_wr
(
const PK_UCHAR_t *key,
int *strid
)
|
Opens a new file for writing with the given Unicode key. The strid returned identifies the file in later read/write operations. Valid function return are FR_no_errors, FR_already_exists, FR_end_of_file, and FR_write_error.
close
int close
(
int strid,
int abort
)
|
Closes the given file. If
abort
is 0, just close it. If
abort
is 1, close and delete the file (this may be given in the case of an error during transmit).
Valid returns are FR_no_errors, FR_close_fail.
Read (rd_****) functions
These functions are defined as follows for chars, bytes, shorts, ints and doubles. In all cases:
-
the function reads one or more items of data from the given file
-
valid returns are FR_no_errors, FR_end_of_file, FR_read_error
rd_chars
int rd_chars
(
int strid,
int n,
char *data
)
|
rd_bytes
int rd_bytes
(
int strid,
int n,
unsigned char *data
)
|
rd_shorts
int rd_shorts
(
int strid,
int n,
short *data
)
|
rd_ints
int rd_ints
(
int strid,
int n,
int *data
)
|
rd_doubles
int rd_doubles
(
int strid,
int n,
double *data
)
|
Write (wr_****) functions
These functions are defined as follows for chars, bytes, shorts, ints and doubles. In all cases:
-
the function writes one or more items of data to the given file
-
valid returns are FR_no_errors, FR_end_of_file, FR_write_error
wr_chars
int wr_chars
(
int strid,
int n,
const char *data
)
|
wr_bytes
int wr_bytes
(
int strid,
int n,
const unsigned char *data
)
|
wr_shorts
int wr_shorts
(
int strid,
int n,
const short *data
)
|
wr_ints
int wr_ints
(
int strid,
int n,
const int *data
)
|
wr_doubles
int wr_doubles
(
int strid,
int n,
const double *data
)
|
[back to top]