File I/O specification.

Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg.

This file is part of the FreeType project, and may only be used modified and distributed under the terms of the FreeType project license, LICENSE.TXT. By continuing to use, modify or distribute this file you indicate that you have read the license and understand and accept it fully.

Notes:

Changes from 1.2 to 1.3:

- Moved stream into TFreeTypeStream object

Changes from 1.1 to 1.2:

- Changes the stream operations semantics. See changes.txt
- Stream records are now allocated on demand in the heap
- Introduced the 'frame cache' to avoid Allocating/Freeing each frame, even tiny ones.
- Support for thread-safety and re-entrancy (for information only)

Changes from 1.0 to 1.1:

- Defined the type TT_Stream for file handles
- Renamed (and cleaned) the API
- Caching and memory-mapped files use the same API as TT_Access_Frame to notify
- Only the interface was really rewritten. This component still only supports one opened file at a time.

Access the next aSize bytes.
Access the next min(aSize ,file_size - file_pos) bytes.
Discards the previously cached frame.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

The following functions should only be used after a AccessFrame and before a ForgetFrame. They do not provide error handling, intentionnaly, and are much faster moreover, they could be converted to MACROS in the C version.

Open a file and return a stream handle for it. Should only be used for the main stream in a new typeface object.

Closes and discards a stream when it is no longer needed. Should only be used for the main stream in a typeface object.

Notifies he component that we're going to use the file opened in 'org_stream', and report errors to the 'error' variable. The 'stream' variable is untouched, except in re-entrant builds.

In re-entrant builds, the original file handle is duplicated to a new stream which reference is passed to the 'stream' variable. Thus, each thread can have its own file cursor to access the same file concurrently.

Closes a stream's font handle. This is useful to save system resources.

Notifies the file component that we don't need to perform file ops on the stream anymore. In re-entrant builds, should also discard the stream.