Collaboration diagram for Functional objects:
|
Modules | |
| Hashtables | |
| A functional hash table is a function from symbols or integers to arbitrary values. | |
| Vectors | |
| A functional vector is a fixed size array of cells. | |
| Ports | |
Data Structures | |
| struct | hashtable_t |
| struct | vector_t |
| struct | muse_port_type_t |
| Defines the Ports protocol. More... | |
Functions | |
| void | muse_define_builtin_type_vector () |
| void | muse_define_builtin_type_hashtable () |
Variables | |
| void(* | muse_port_type_t::close )(void *port) |
| The close function should release all system resources allocated by the port object. | |
| size_t(* | muse_port_type_t::read )(void *buffer, size_t nbytes, void *port) |
Should read nbytes bytes from the port and copy them to the given buffer. | |
| size_t(* | muse_port_type_t::write )(void *buffer, size_t nbytes, void *port) |
Should write the given nbytes bytes to the port. | |
| int(* | muse_port_type_t::flush )(void *port) |
| If a port is buffered at the system level, this should call the system flush function appropriate for the task. | |
| int | muse_port_buffer_t::size |
| int | muse_port_buffer_t::avail |
| int | muse_port_buffer_t::pos |
| size_t | muse_port_buffer_t::fpos |
| muse_port_buffer_t | _muse_port_base_t::in |
| muse_port_buffer_t | _muse_port_base_t::out |
| int | _muse_port_base_t::mode |
| int | _muse_port_base_t::eof |
| int | _muse_port_base_t::error |
| int | _muse_port_base_t::pretty_print |
| int | _muse_port_base_t::tab_size |
For each such new type, you define a global type info structure muse_functional_object_type_t that holds the type information of the object, including methods to keep track of cell references held by the object, how to destroy it, etc.
muSE ports are also implemented as functional objects, though they don't have an associated function and have to be used through the generic "read", "write" and such functions.
| void muse_define_builtin_type_vector | ( | ) |
| void muse_define_builtin_type_hashtable | ( | ) |
void(* muse_port_type_t::close)(void *port) [inherited] |
The close function should release all system resources allocated by the port object.
Similar to the system fclose() function.
size_t(* muse_port_type_t::read)(void *buffer, size_t nbytes, void *port) [inherited] |
Should read nbytes bytes from the port and copy them to the given buffer.
Can read less than nbytes bytes if that many are not available, but must at least read 1 byte.
size_t(* muse_port_type_t::write)(void *buffer, size_t nbytes, void *port) [inherited] |
Should write the given nbytes bytes to the port.
Must not perform an incomplete write. For network ports, this means it should continuously try writing any remaining data until all of it gets written.
nbytes upon success and 0 upon error. int(* muse_port_type_t::flush)(void *port) [inherited] |
If a port is buffered at the system level, this should call the system flush function appropriate for the task.
int muse_port_buffer_t::size [inherited] |
int muse_port_buffer_t::avail [inherited] |
int muse_port_buffer_t::pos [inherited] |
size_t muse_port_buffer_t::fpos [inherited] |
muse_port_buffer_t _muse_port_base_t::in [inherited] |
muse_port_buffer_t _muse_port_base_t::out [inherited] |
int _muse_port_base_t::mode [inherited] |
int _muse_port_base_t::eof [inherited] |
int _muse_port_base_t::error [inherited] |
int _muse_port_base_t::pretty_print [inherited] |
int _muse_port_base_t::tab_size [inherited] |
1.4.7